mirror of
https://github.com/yeban8090/note-to-red.git
synced 2026-07-22 05:42:34 +00:00
commit
554f7dfb9e
5 changed files with 69 additions and 35 deletions
|
|
@ -1,7 +1,7 @@
|
|||
# Note to RED
|
||||
一键将 Obsidian 笔记转换为小红书图片格式的插件。
|
||||
|
||||
   [](https://ko-fi.com/bruceyeban)
|
||||
   [](https://ko-fi.com/bruceyeban)
|
||||
|
||||
## 功能特点
|
||||
- 📝 使用二级标题分割内容,每个标题自动生成一张配图
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "note-to-red",
|
||||
"name": "Note to RED",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"minAppVersion": "0.15.0",
|
||||
"description": "Convert Markdown notes to RED (Xiaohongshu) style images",
|
||||
"author": "Yeban",
|
||||
|
|
|
|||
BIN
src/assets/preview/screenshot1.png
Normal file
BIN
src/assets/preview/screenshot1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 454 KiB |
|
|
@ -558,40 +558,40 @@ export class CreateThemeModal extends Modal {
|
|||
.replace(/border:\s*1px solid\s*#[a-fA-F0-9]+80/, `border: 1px solid ${value}80`);
|
||||
});
|
||||
});
|
||||
|
||||
new Setting(headerSection)
|
||||
.setName('认证图标颜色')
|
||||
.setDesc('设置认证(已验证)图标的主色')
|
||||
.addColorPicker(color => {
|
||||
// 兼容 background: linear-gradient(...) 和 background-color: ...
|
||||
let currentColor = '#b87333';
|
||||
const bgMatch = styles.verifiedIcon.match(/background:\s*linear-gradient\([^,]+,\s*(#[a-fA-F0-9]+)/);
|
||||
if (bgMatch) {
|
||||
currentColor = bgMatch[1];
|
||||
} else {
|
||||
const colorMatch = styles.verifiedIcon.match(/background-color:\s*(#[a-fA-F0-9]+)/);
|
||||
if (colorMatch) {
|
||||
currentColor = colorMatch[1];
|
||||
|
||||
new Setting(headerSection)
|
||||
.setName('认证图标颜色')
|
||||
.setDesc('设置认证(已验证)图标的主色')
|
||||
.addColorPicker(color => {
|
||||
// 兼容 background: linear-gradient(...) 和 background-color: ...
|
||||
let currentColor = '#b87333';
|
||||
const bgMatch = styles.verifiedIcon.match(/background:\s*linear-gradient\([^,]+,\s*(#[a-fA-F0-9]+)/);
|
||||
if (bgMatch) {
|
||||
currentColor = bgMatch[1];
|
||||
} else {
|
||||
const colorMatch = styles.verifiedIcon.match(/background-color:\s*(#[a-fA-F0-9]+)/);
|
||||
if (colorMatch) {
|
||||
currentColor = colorMatch[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
color.setValue(currentColor)
|
||||
.onChange(value => {
|
||||
// 先处理 linear-gradient
|
||||
if (styles.verifiedIcon.includes('linear-gradient')) {
|
||||
color.setValue(currentColor)
|
||||
.onChange(value => {
|
||||
// 先处理 linear-gradient
|
||||
if (styles.verifiedIcon.includes('linear-gradient')) {
|
||||
styles.verifiedIcon = styles.verifiedIcon
|
||||
.replace(/background:\s*linear-gradient\([^)]+\)/, `background: linear-gradient(135deg, ${value}, ${value})`);
|
||||
}
|
||||
// 再处理 background-color
|
||||
if (styles.verifiedIcon.includes('background-color')) {
|
||||
styles.verifiedIcon = styles.verifiedIcon
|
||||
.replace(/background-color:\s*#[a-fA-F0-9]+/, `background-color: ${value}`);
|
||||
}
|
||||
// 统一处理 border 和 box-shadow
|
||||
styles.verifiedIcon = styles.verifiedIcon
|
||||
.replace(/background:\s*linear-gradient\([^)]+\)/, `background: linear-gradient(135deg, ${value}, ${value})`);
|
||||
}
|
||||
// 再处理 background-color
|
||||
if (styles.verifiedIcon.includes('background-color')) {
|
||||
styles.verifiedIcon = styles.verifiedIcon
|
||||
.replace(/background-color:\s*#[a-fA-F0-9]+/, `background-color: ${value}`);
|
||||
}
|
||||
// 统一处理 border 和 box-shadow
|
||||
styles.verifiedIcon = styles.verifiedIcon
|
||||
.replace(/border:\s*1px solid\s*#[a-fA-F0-9]+80/, `border: 1px solid ${value}80`)
|
||||
.replace(/box-shadow:\s*0 2px 8px [^;]+;/, `box-shadow: 0 2px 8px ${value}1a;`);
|
||||
});
|
||||
});
|
||||
.replace(/border:\s*1px solid\s*#[a-fA-F0-9]+80/, `border: 1px solid ${value}80`)
|
||||
.replace(/box-shadow:\s*0 2px 8px [^;]+;/, `box-shadow: 0 2px 8px ${value}1a;`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private addTitleSettings(container: HTMLElement, styles: any) {
|
||||
|
|
@ -669,6 +669,38 @@ export class CreateThemeModal extends Modal {
|
|||
styles.container = styles.container.replace(/background:\s*[^;]+/, `background: ${value}`);
|
||||
});
|
||||
});
|
||||
// 新增:页脚上下内边距设置(只改第一个值,第二个值保持原样)
|
||||
new Setting(footerSection)
|
||||
.setName('上下内边距')
|
||||
.setDesc('设置页脚区域的上下内边距(单位:px)')
|
||||
.addText(text => {
|
||||
// 解析当前padding
|
||||
let match = styles.container.match(/padding:\s*(\d+)px\s*(\d+)px/);
|
||||
let paddingTop = '16', paddingLR = '16';
|
||||
if (match) {
|
||||
paddingTop = match[1];
|
||||
paddingLR = match[2];
|
||||
} else {
|
||||
// 兼容只有一个值的情况
|
||||
let single = styles.container.match(/padding:\s*(\d+)px/);
|
||||
if (single) {
|
||||
paddingTop = single[1];
|
||||
paddingLR = single[1];
|
||||
}
|
||||
}
|
||||
text.setValue(paddingTop)
|
||||
.onChange(value => {
|
||||
const v = parseInt(value) || 16;
|
||||
// 只替换第一个值,第二个值保持原样
|
||||
if (styles.container.match(/padding:\s*\d+px\s*\d+px/)) {
|
||||
styles.container = styles.container.replace(/padding:\s*\d+px\s*\d+px/, `padding: ${v}px ${paddingLR}px`);
|
||||
} else if (styles.container.match(/padding:\s*\d+px/)) {
|
||||
styles.container = styles.container.replace(/padding:\s*\d+px/, `padding: ${v}px ${paddingLR}px`);
|
||||
} else {
|
||||
styles.container += ` padding: ${v}px ${paddingLR}px;`;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private addParagraphAndEmphasisSettings(container: HTMLElement, styles: any) {
|
||||
|
|
|
|||
|
|
@ -81,11 +81,13 @@
|
|||
margin: 0 20px 0 10px;
|
||||
flex: none ;
|
||||
}
|
||||
.red-controls-group .red-like-button {
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.red-controls-group .red-export-button {
|
||||
background-color: var(--text-accent);
|
||||
color: var(--text-on-accent);
|
||||
border: none;
|
||||
}
|
||||
.red-controls-group .red-export-button:hover {
|
||||
color: var(--text-on-accent);
|
||||
|
|
|
|||
Loading…
Reference in a new issue