update at 2025-10-16 14:24:10

This commit is contained in:
douboer
2025-10-16 14:24:10 +08:00
parent 5e1351408e
commit 9f3a4e8812
41 changed files with 2377 additions and 2363 deletions

View File

@@ -152,14 +152,14 @@ export class ArticleRender implements MDRendererCallback {
isOldTheme() {
const theme = this.assetsManager.getTheme(this.currentTheme);
if (theme) {
return theme.css.indexOf('.note-to-mp') < 0;
return theme.css.indexOf('.note2any') < 0;
}
return false;
}
setArticle(article: string) {
this.articleDiv.empty();
let className = 'note-to-mp';
let className = 'note2any';
// 兼容旧版本样式
if (this.isOldTheme()) {
className = this.currentTheme;
@@ -289,7 +289,7 @@ export class ArticleRender implements MDRendererCallback {
const theme = this.assetsManager.getTheme(this.currentTheme);
const highlight = this.assetsManager.getHighlight(this.currentHighlight);
const customCSS = this.settings.customCSSNote.length > 0 || this.settings.useCustomCss ? this.assetsManager.customCSS : '';
const baseCSS = this.settings.baseCSS ? `.note-to-mp {${this.settings.baseCSS}}` : '';
const baseCSS = this.settings.baseCSS ? `.note2any {${this.settings.baseCSS}}` : '';
return `${InlineCSS}\n\n${highlight!.css}\n\n${theme!.css}\n\n${baseCSS}\n\n${customCSS}`;
} catch (error) {
console.error(error);

View File

@@ -7,7 +7,7 @@ const css = `
/* =========================================================== */
/* Obsidian的默认样式 */
/* =========================================================== */
.note-to-mp {
.note2any {
padding: 0;
user-select: text;
-webkit-user-select: text;
@@ -15,15 +15,15 @@ const css = `
font-size: 16px;
}
.note-to-mp:last-child {
.note2any:last-child {
margin-bottom: 0;
}
.note-to-mp .fancybox-img {
.note2any .fancybox-img {
border: none;
}
.note-to-mp .fancybox-img:hover {
.note2any .fancybox-img:hover {
opacity: none;
border: none;
}
@@ -33,7 +33,7 @@ const css = `
Heading
==================================
*/
.note-to-mp h1 {
.note2any h1 {
color: #222;
font-weight: 700;
font-size: 1.802em;
@@ -42,7 +42,7 @@ Heading
margin-block-end: 0;
}
.note-to-mp h2 {
.note2any h2 {
color: #222;
font-weight: 600;
font-size: 1.602em;
@@ -51,7 +51,7 @@ Heading
margin-block-end: 0;
}
.note-to-mp h3 {
.note2any h3 {
color: #222;
font-weight: 600;
font-size: 1.424em;
@@ -60,7 +60,7 @@ Heading
margin-block-end: 0;
}
.note-to-mp h4 {
.note2any h4 {
color: #222;
font-weight: 600;
font-size: 1.266em;
@@ -69,13 +69,13 @@ Heading
margin-block-end: 0;
}
.note-to-mp h5 {
.note2any h5 {
color: #222;
margin-block-start: 1em;
margin-block-end: 0;
}
.note-to-mp h6 {
.note2any h6 {
color: #222;
margin-block-start: 1em;
margin-block-end: 0;
@@ -86,7 +86,7 @@ Heading
Horizontal Rules
==================================
*/
.note-to-mp hr {
.note2any hr {
border-color: #e0e0e0;
margin-top: 3em;
margin-bottom: 3em;
@@ -97,7 +97,7 @@ Horizontal Rules
Paragraphs
==================================
*/
.note-to-mp p {
.note2any p {
line-height: 1.6em;
margin: 1em 0;
}
@@ -107,17 +107,17 @@ Paragraphs
Emphasis
==================================
*/
.note-to-mp strong {
.note2any strong {
color: #222222;
font-weight: 600;
}
.note-to-mp em {
.note2any em {
color: inherit;
font-style: italic;
}
.note-to-mp s {
.note2any s {
color: inherit;
}
@@ -126,7 +126,7 @@ Emphasis
Blockquotes
==================================
*/
.note-to-mp blockquote {
.note2any blockquote {
font-size: 1rem;
display: block;
margin: 2em 0;
@@ -136,15 +136,15 @@ Emphasis
border-left: 0.15rem solid #7852ee;
}
.note-to-mp blockquote blockquote {
.note2any blockquote blockquote {
margin: 0 0;
}
.note-to-mp blockquote p {
.note2any blockquote p {
margin: 0;
}
.note-to-mp blockquote footer strong {
.note2any blockquote footer strong {
margin-right: 0.5em;
}
@@ -153,23 +153,23 @@ Emphasis
List
==================================
*/
.note-to-mp ul {
.note2any ul {
margin: 0;
margin-top: 1.25em;
margin-bottom: 1.25em;
line-height: 1.6em;
}
.note-to-mp ul>li::marker {
.note2any ul>li::marker {
color: #ababab;
/* font-size: 1.5em; */
}
.note-to-mp li>p {
.note2any li>p {
margin: 0;
}
.note-to-mp ol {
.note2any ol {
margin: 0;
padding: 0;
margin-top: 1.25em;
@@ -178,7 +178,7 @@ List
line-height: 1.6em;
}
.note-to-mp ol>li {
.note2any ol>li {
position: relative;
padding-left: 0.1em;
margin-left: 2em;
@@ -189,7 +189,7 @@ List
Link
==================================
*/
.note-to-mp a {
.note2any a {
color: #7852ee;
text-decoration: none;
font-weight: 500;
@@ -198,7 +198,7 @@ Link
transition: border 0.3s ease-in-out;
}
.note-to-mp a:hover {
.note2any a:hover {
color: #7952eebb;
border-bottom: 1px solid #7952eebb;
}
@@ -208,7 +208,7 @@ Link
Table
==================================
*/
.note-to-mp table {
.note2any table {
width: 100%;
table-layout: auto;
text-align: left;
@@ -221,13 +221,13 @@ Table
text-indent: 0;
}
.note-to-mp table thead {
.note2any table thead {
color: #000;
font-weight: 600;
border: #e0e0e0 1px solid;
}
.note-to-mp table thead th {
.note2any table thead th {
vertical-align: bottom;
padding-right: 0.5714286em;
padding-bottom: 0.5714286em;
@@ -235,24 +235,24 @@ Table
border: #e0e0e0 1px solid;
}
.note-to-mp table thead th:first-child {
.note2any table thead th:first-child {
padding-left: 0.5em;
}
.note-to-mp table thead th:last-child {
.note2any table thead th:last-child {
padding-right: 0.5em;
}
.note-to-mp table tbody tr {
.note2any table tbody tr {
border-style: solid;
border: #e0e0e0 1px solid;
}
.note-to-mp table tbody tr:last-child {
.note2any table tbody tr:last-child {
border-bottom-width: 0;
}
.note-to-mp table tbody td {
.note2any table tbody td {
vertical-align: top;
padding-top: 0.5714286em;
padding-right: 0.5714286em;
@@ -261,11 +261,11 @@ Table
border: #e0e0e0 1px solid;
}
.note-to-mp table tbody td:first-child {
.note2any table tbody td:first-child {
padding-left: 0;
}
.note-to-mp table tbody td:last-child {
.note2any table tbody td:last-child {
padding-right: 0;
}
@@ -274,11 +274,11 @@ Table
Images
==================================
*/
.note-to-mp img {
.note2any img {
margin: 2em auto;
}
.note-to-mp .footnotes hr {
.note2any .footnotes hr {
margin-top: 4em;
margin-bottom: 0.5em;
}
@@ -288,7 +288,7 @@ Images
Code
==================================
*/
.note-to-mp .code-section {
.note2any .code-section {
display: flex;
border: rgb(240, 240, 240) 1px solid;
line-height: 26px;
@@ -298,7 +298,7 @@ Code
box-sizing: border-box;
}
.note-to-mp .code-section ul {
.note2any .code-section ul {
width: fit-content;
margin-block-start: 0;
margin-block-end: 0;
@@ -310,11 +310,11 @@ Code
backgroud: transparent !important;
}
.note-to-mp .code-section ul>li {
.note2any .code-section ul>li {
text-align: right;
}
.note-to-mp .code-section pre {
.note2any .code-section pre {
margin-block-start: 0;
margin-block-end: 0;
white-space: normal;
@@ -322,7 +322,7 @@ Code
padding: 0 0 0 0.875em;
}
.note-to-mp .code-section code {
.note2any .code-section code {
display: flex;
text-wrap: nowrap;
font-family: Consolas,Courier,monospace;

View File

@@ -189,7 +189,7 @@ export class XiaohongshuPreview {
const tempContainer = document.createElement('div');
tempContainer.innerHTML = articleHTML;
tempContainer.style.width = `${this.settings.sliceImageWidth}px`;
tempContainer.classList.add('note-to-mp');
tempContainer.classList.add('note2any');
if (this.currentThemeClass) {
tempContainer.classList.add(this.currentThemeClass);
}
@@ -226,7 +226,7 @@ export class XiaohongshuPreview {
const wrapper = this.pageContainer.createDiv({ cls: 'xhs-page-wrapper' });
const classes = ['xhs-page'];
if (this.currentThemeClass) classes.push('note-to-mp');
if (this.currentThemeClass) classes.push('note2any');
const pageElement = wrapper.createDiv({ cls: classes.join(' ') });
renderPage(pageElement, page.content, this.settings);
this.applyPreviewSizing(wrapper, pageElement);
@@ -510,7 +510,7 @@ export class XiaohongshuPreview {
const theme = this.assetsManager.getTheme(themeName);
const highlight = this.assetsManager.getHighlight(highlightName);
const customCSS = (this.settings.useCustomCss || this.settings.customCSSNote.length>0) ? this.assetsManager.customCSS : '';
const baseCSS = this.settings.baseCSS ? `.note-to-mp {${this.settings.baseCSS}}` : '';
const baseCSS = this.settings.baseCSS ? `.note2any {${this.settings.baseCSS}}` : '';
const css = `${highlight?.css || ''}\n\n${theme?.css || ''}\n\n${baseCSS}\n\n${customCSS}`;
this.styleEl.textContent = css;
this.currentThemeClass = theme?.className || '';
@@ -527,8 +527,8 @@ export class XiaohongshuPreview {
tempContainer.style.width = `${this.settings.sliceImageWidth}px`;
tempContainer.style.fontSize = `${this.currentFontSize}px`;
// 字体从全局主题中继承,无需手动指定
tempContainer.classList.add('note-to-mp');
tempContainer.className = this.currentThemeClass ? `note-to-mp ${this.currentThemeClass}` : 'note-to-mp';
tempContainer.classList.add('note2any');
tempContainer.className = this.currentThemeClass ? `note2any ${this.currentThemeClass}` : 'note2any';
document.body.appendChild(tempContainer);
try {
this.pages = await paginateArticle(tempContainer, this.settings);