@rbbtsn0w/wechat-markdown 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +121 -52
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +31 -5
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/inliner/dom-patcher.d.ts.map +1 -1
- package/dist/inliner/dom-patcher.js +34 -3
- package/dist/inliner/dom-patcher.js.map +1 -1
- package/dist/inliner/inliner.d.ts.map +1 -1
- package/dist/inliner/inliner.js.map +1 -1
- package/dist/media/formula.d.ts.map +1 -1
- package/dist/media/formula.js +4 -1
- package/dist/media/formula.js.map +1 -1
- package/dist/plugins/alerts.d.ts.map +1 -1
- package/dist/plugins/alerts.js.map +1 -1
- package/dist/plugins/code-decorator.d.ts +4 -2
- package/dist/plugins/code-decorator.d.ts.map +1 -1
- package/dist/plugins/code-decorator.js +109 -6
- package/dist/plugins/code-decorator.js.map +1 -1
- package/dist/plugins/footnotes.d.ts.map +1 -1
- package/dist/plugins/footnotes.js +4 -0
- package/dist/plugins/footnotes.js.map +1 -1
- package/dist/plugins/highlighter.d.ts +40 -0
- package/dist/plugins/highlighter.d.ts.map +1 -0
- package/dist/plugins/highlighter.js +205 -0
- package/dist/plugins/highlighter.js.map +1 -0
- package/dist/plugins/image-figure.d.ts +9 -0
- package/dist/plugins/image-figure.d.ts.map +1 -0
- package/dist/plugins/image-figure.js +52 -0
- package/dist/plugins/image-figure.js.map +1 -0
- package/dist/plugins/task-list.d.ts +9 -0
- package/dist/plugins/task-list.d.ts.map +1 -0
- package/dist/plugins/task-list.js +59 -0
- package/dist/plugins/task-list.js.map +1 -0
- package/dist/themes/geek.d.ts +1 -1
- package/dist/themes/geek.d.ts.map +1 -1
- package/dist/themes/geek.js +17 -0
- package/dist/themes/geek.js.map +1 -1
- package/dist/themes/grace.d.ts +1 -1
- package/dist/themes/grace.d.ts.map +1 -1
- package/dist/themes/grace.js +17 -0
- package/dist/themes/grace.js.map +1 -1
- package/dist/themes/index.d.ts.map +1 -1
- package/dist/themes/index.js +1 -3
- package/dist/themes/index.js.map +1 -1
- package/dist/themes/tech.d.ts +1 -1
- package/dist/themes/tech.d.ts.map +1 -1
- package/dist/themes/tech.js +13 -4
- package/dist/themes/tech.js.map +1 -1
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +6 -2
|
@@ -5,7 +5,9 @@ exports.decorateCodeBlocks = decorateCodeBlocks;
|
|
|
5
5
|
/**
|
|
6
6
|
* Structural styling for the markup this plugin emits, in neutral colors.
|
|
7
7
|
* Ships with the capability so a theme only has to supply brand overrides.
|
|
8
|
-
* Must never use !important
|
|
8
|
+
* Must never use !important on brand properties, but layout-critical properties
|
|
9
|
+
* like white-space: pre and overflow-x: auto must use !important so they
|
|
10
|
+
* survive WeChat Webview's aggressive global typography resets.
|
|
9
11
|
*/
|
|
10
12
|
exports.codeDecoratorBaseCss = `
|
|
11
13
|
.mac-code-wrapper {
|
|
@@ -46,15 +48,116 @@ exports.codeDecoratorBaseCss = `
|
|
|
46
48
|
text-transform: uppercase;
|
|
47
49
|
font-family: Menlo, Monaco, Consolas, monospace;
|
|
48
50
|
}
|
|
51
|
+
|
|
52
|
+
.mac-code-wrapper pre {
|
|
53
|
+
margin: 0 !important;
|
|
54
|
+
padding: 14px 16px !important;
|
|
55
|
+
background-color: #282c34;
|
|
56
|
+
color: #abb2bf;
|
|
57
|
+
font-family: Consolas, Monaco, Menlo, "Courier New", monospace !important;
|
|
58
|
+
font-size: 13px !important;
|
|
59
|
+
line-height: 1.6 !important;
|
|
60
|
+
overflow-x: auto !important;
|
|
61
|
+
white-space: pre !important;
|
|
62
|
+
word-break: normal !important;
|
|
63
|
+
word-wrap: normal !important;
|
|
64
|
+
display: block !important;
|
|
65
|
+
-webkit-overflow-scrolling: touch !important;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.mac-code-wrapper pre code {
|
|
69
|
+
font-family: inherit !important;
|
|
70
|
+
font-size: inherit !important;
|
|
71
|
+
padding: 0 !important;
|
|
72
|
+
border: none !important;
|
|
73
|
+
border-radius: 0 !important;
|
|
74
|
+
display: block !important;
|
|
75
|
+
white-space: pre !important;
|
|
76
|
+
word-break: normal !important;
|
|
77
|
+
word-wrap: normal !important;
|
|
78
|
+
}
|
|
49
79
|
`;
|
|
80
|
+
const LANGUAGE_DISPLAY_NAMES = {
|
|
81
|
+
ts: 'TYPESCRIPT',
|
|
82
|
+
typescript: 'TYPESCRIPT',
|
|
83
|
+
js: 'JAVASCRIPT',
|
|
84
|
+
javascript: 'JAVASCRIPT',
|
|
85
|
+
jsx: 'JSX',
|
|
86
|
+
tsx: 'TSX',
|
|
87
|
+
swift: 'SWIFT',
|
|
88
|
+
py: 'PYTHON',
|
|
89
|
+
python: 'PYTHON',
|
|
90
|
+
rb: 'RUBY',
|
|
91
|
+
ruby: 'RUBY',
|
|
92
|
+
sh: 'SHELL',
|
|
93
|
+
bash: 'BASH',
|
|
94
|
+
zsh: 'ZSH',
|
|
95
|
+
shell: 'SHELL',
|
|
96
|
+
console: 'CONSOLE',
|
|
97
|
+
terminal: 'TERMINAL',
|
|
98
|
+
json: 'JSON',
|
|
99
|
+
yml: 'YAML',
|
|
100
|
+
yaml: 'YAML',
|
|
101
|
+
md: 'MARKDOWN',
|
|
102
|
+
markdown: 'MARKDOWN',
|
|
103
|
+
html: 'HTML',
|
|
104
|
+
xml: 'XML',
|
|
105
|
+
css: 'CSS',
|
|
106
|
+
scss: 'SCSS',
|
|
107
|
+
less: 'LESS',
|
|
108
|
+
sql: 'SQL',
|
|
109
|
+
c: 'C',
|
|
110
|
+
cpp: 'C++',
|
|
111
|
+
'c++': 'C++',
|
|
112
|
+
cs: 'C#',
|
|
113
|
+
csharp: 'C#',
|
|
114
|
+
go: 'GO',
|
|
115
|
+
golang: 'GO',
|
|
116
|
+
rs: 'RUST',
|
|
117
|
+
rust: 'RUST',
|
|
118
|
+
java: 'JAVA',
|
|
119
|
+
kt: 'KOTLIN',
|
|
120
|
+
kotlin: 'KOTLIN',
|
|
121
|
+
dart: 'DART',
|
|
122
|
+
diff: 'DIFF',
|
|
123
|
+
docker: 'DOCKERFILE',
|
|
124
|
+
dockerfile: 'DOCKERFILE',
|
|
125
|
+
graphql: 'GRAPHQL',
|
|
126
|
+
gql: 'GRAPHQL',
|
|
127
|
+
text: 'TEXT',
|
|
128
|
+
txt: 'TEXT',
|
|
129
|
+
plaintext: 'TEXT',
|
|
130
|
+
};
|
|
131
|
+
function formatDisplayLanguage(rawClass) {
|
|
132
|
+
if (!rawClass) {
|
|
133
|
+
return 'CODE';
|
|
134
|
+
}
|
|
135
|
+
// 1. Extract language identifier from class string like "language-typescript", "language-swift"
|
|
136
|
+
const langMatch = rawClass.match(/language-([a-zA-Z0-9_+#.-]+)/i);
|
|
137
|
+
if (langMatch) {
|
|
138
|
+
const rawLang = langMatch[1].toLowerCase();
|
|
139
|
+
if (LANGUAGE_DISPLAY_NAMES[rawLang]) {
|
|
140
|
+
return LANGUAGE_DISPLAY_NAMES[rawLang];
|
|
141
|
+
}
|
|
142
|
+
return rawLang.toUpperCase();
|
|
143
|
+
}
|
|
144
|
+
// 2. Check for standalone language token
|
|
145
|
+
const token = rawClass.trim().split(/\s+/)[0]?.toLowerCase();
|
|
146
|
+
if (token && LANGUAGE_DISPLAY_NAMES[token]) {
|
|
147
|
+
return LANGUAGE_DISPLAY_NAMES[token];
|
|
148
|
+
}
|
|
149
|
+
return 'CODE';
|
|
150
|
+
}
|
|
50
151
|
function decorateCodeBlocks(html, enabled = true) {
|
|
51
152
|
if (!enabled) {
|
|
52
153
|
return html;
|
|
53
154
|
}
|
|
54
|
-
// Regex to match <pre
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
155
|
+
// Regex to match <pre...><code...>...</code></pre> across multiple formatting variations
|
|
156
|
+
// (with or without language classes, titles, or custom attributes)
|
|
157
|
+
const preRegex = /<pre\b[^>]*><code(?:\s+[^>]*class=["']([^"']+)["'][^>]*|[^>]*)>([\s\S]*?)<\/code><\/pre>/gi;
|
|
158
|
+
return html.replace(preRegex, (match, rawClass, codeContent) => {
|
|
159
|
+
const displayLang = formatDisplayLanguage(rawClass);
|
|
160
|
+
const codeClassAttr = rawClass ? ` class="${rawClass}"` : '';
|
|
58
161
|
return `
|
|
59
162
|
<section class="mac-code-wrapper">
|
|
60
163
|
<section class="mac-code-header">
|
|
@@ -65,7 +168,7 @@ function decorateCodeBlocks(html, enabled = true) {
|
|
|
65
168
|
</section>
|
|
66
169
|
<span class="mac-code-lang">${displayLang}</span>
|
|
67
170
|
</section>
|
|
68
|
-
<pre><code>${codeContent}</code></pre>
|
|
171
|
+
<pre><code${codeClassAttr}>${codeContent}</code></pre>
|
|
69
172
|
</section>
|
|
70
173
|
`.trim();
|
|
71
174
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-decorator.js","sourceRoot":"","sources":["../../src/plugins/code-decorator.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"code-decorator.js","sourceRoot":"","sources":["../../src/plugins/code-decorator.ts"],"names":[],"mappings":";;;AAwJA,gDA2BC;AAnLD;;;;;;GAMG;AACU,QAAA,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmEnC,CAAC;AAEF,MAAM,sBAAsB,GAA2B;IACrD,EAAE,EAAE,YAAY;IAChB,UAAU,EAAE,YAAY;IACxB,EAAE,EAAE,YAAY;IAChB,UAAU,EAAE,YAAY;IACxB,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,EAAE,EAAE,QAAQ;IACZ,MAAM,EAAE,QAAQ;IAChB,EAAE,EAAE,MAAM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C5B,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,wBAAgB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"footnotes.d.ts","sourceRoot":"","sources":["../../src/plugins/footnotes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,kjBAkC5B,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,YAAY,EAAE,CAAC;CAC3B;AAED,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,MAAM,GACf,sBAAsB,CAgDxB;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,MAAM,CAiBrE"}
|
|
@@ -53,6 +53,10 @@ function processMarkdownFootnotes(markdown, siteUrl) {
|
|
|
53
53
|
if (url.startsWith('#') || url.startsWith('javascript:') || url.startsWith('mailto:')) {
|
|
54
54
|
return false;
|
|
55
55
|
}
|
|
56
|
+
// WeChat allows internal article links on mp.weixin.qq.com natively
|
|
57
|
+
if (/^https?:\/\/([a-zA-Z0-9-]+\.)*mp\.weixin\.qq\.com(\/|$)/i.test(url)) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
56
60
|
if (siteUrl && url.startsWith(siteUrl)) {
|
|
57
61
|
return false;
|
|
58
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footnotes.js","sourceRoot":"","sources":["../../src/plugins/footnotes.ts"],"names":[],"mappings":";;;AAkDA,
|
|
1
|
+
{"version":3,"file":"footnotes.js","sourceRoot":"","sources":["../../src/plugins/footnotes.ts"],"names":[],"mappings":";;;AAkDA,4DAmDC;AAED,kDAiBC;AAtHD;;;;;;GAMG;AACU,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AI,CAAC,KAAK,EAAE,CAAC;YACX,KAAK,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;YAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACvB,SAAS,CAAC,IAAI,CAAC;gBACb,KAAK;gBACL,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE;gBAClB,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE;aAChB,CAAC,CAAC;QACL,CAAC;QAED,OAAO,GAAG,IAAI,8BAA8B,KAAK,SAAS,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ,EAAE,mBAAmB;QAC7B,SAAS;KACV,CAAC;AACJ,CAAC;AAED,SAAgB,mBAAmB,CAAC,SAAyB;IAC3D,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,SAAS,GAAG,SAAS;SACxB,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,OAAO,qCAAqC,IAAI,CAAC,KAAK,cAAc,IAAI,CAAC,KAAK,gCAAgC,IAAI,CAAC,GAAG,aAAa,CAAC;IACtI,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;IAEd,OAAO;;;IAGL,SAAS;;CAEZ,CAAC,IAAI,EAAE,CAAC;AACT,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Syntax Highlighting Plugin for WeChat Official Account Markdown Rendering.
|
|
3
|
+
*
|
|
4
|
+
* Inspired by and adapted from the open-source industry standard doocs/md:
|
|
5
|
+
* https://github.com/doocs/md (MIT License)
|
|
6
|
+
*
|
|
7
|
+
* Uses highlight.js for AST-level lexical highlighting, generating class-tagged
|
|
8
|
+
* spans that are subsequently inlined by Juice into safe, bulletproof WeChat inline styles.
|
|
9
|
+
*/
|
|
10
|
+
export type HighlightThemeName = 'atom-one-dark' | 'github-light' | 'monokai';
|
|
11
|
+
export declare const atomOneDarkCss = "\n.markdown-body pre code.hljs, .mac-code-wrapper pre code.hljs, code.hljs, .hljs { color: #abb2bf; background: #282c34; background-color: #282c34; }\n.hljs-comment, .hljs-quote { color: #5c6370; font-style: italic; }\n.hljs-doctag, .hljs-keyword, .hljs-formula { color: #c678dd; font-weight: bold; }\n.hljs-section, .hljs-name, .hljs-selector-tag, .hljs-deletion, .hljs-subst { color: #e06c75; }\n.hljs-literal { color: #56b6c2; }\n.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-meta .hljs-string { color: #98c379; }\n.hljs-built_in, .hljs-title.class_, .hljs-class .hljs-title { color: #e5c07b; }\n.hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-type, .hljs-selector-attr, .hljs-selector-pseudo, .hljs-number { color: #d19a66; }\n.hljs-symbol, .hljs-bullet, .hljs-link, .hljs-meta, .hljs-selector-id, .hljs-title, .hljs-title.function_ { color: #61aeee; }\n.hljs-emphasis { font-style: italic; }\n.hljs-strong { font-weight: bold; }\n";
|
|
12
|
+
export declare const githubLightCss = "\n.markdown-body pre code.hljs, .mac-code-wrapper pre code.hljs, code.hljs, .hljs { color: #24292e; background: #f6f8fa; background-color: #f6f8fa; }\n.hljs-comment, .hljs-quote { color: #6a737d; font-style: italic; }\n.hljs-doctag, .hljs-keyword, .hljs-formula { color: #d73a49; font-weight: bold; }\n.hljs-section, .hljs-name, .hljs-selector-tag, .hljs-deletion, .hljs-subst { color: #d73a49; }\n.hljs-literal { color: #005cc5; }\n.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-meta .hljs-string { color: #032f62; }\n.hljs-built_in, .hljs-title.class_, .hljs-class .hljs-title { color: #6f42c1; }\n.hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-type, .hljs-selector-attr, .hljs-selector-pseudo, .hljs-number { color: #e36209; }\n.hljs-symbol, .hljs-bullet, .hljs-link, .hljs-meta, .hljs-selector-id, .hljs-title, .hljs-title.function_ { color: #005cc5; }\n.hljs-emphasis { font-style: italic; }\n.hljs-strong { font-weight: bold; }\n";
|
|
13
|
+
export declare const monokaiCss = "\n.markdown-body pre code.hljs, .mac-code-wrapper pre code.hljs, code.hljs, .hljs { color: #f8f8f2; background: #272822; background-color: #272822; }\n.hljs-comment, .hljs-quote { color: #75715e; font-style: italic; }\n.hljs-doctag, .hljs-keyword, .hljs-formula { color: #f92672; font-weight: bold; }\n.hljs-section, .hljs-name, .hljs-selector-tag, .hljs-deletion, .hljs-subst { color: #f92672; }\n.hljs-literal { color: #ae81ff; }\n.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-meta .hljs-string { color: #e6db74; }\n.hljs-built_in, .hljs-title.class_, .hljs-class .hljs-title { color: #a6e22e; }\n.hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-type, .hljs-selector-attr, .hljs-selector-pseudo, .hljs-number { color: #fd971f; }\n.hljs-symbol, .hljs-bullet, .hljs-link, .hljs-meta, .hljs-selector-id, .hljs-title, .hljs-title.function_ { color: #66d9ef; }\n.hljs-emphasis { font-style: italic; }\n.hljs-strong { font-weight: bold; }\n";
|
|
14
|
+
export declare const highlightBaseCss = "\n.markdown-body pre code.hljs, .mac-code-wrapper pre code.hljs, code.hljs, .hljs { color: #abb2bf; background: #282c34; background-color: #282c34; }\n.hljs-comment, .hljs-quote { color: #5c6370; font-style: italic; }\n.hljs-doctag, .hljs-keyword, .hljs-formula { color: #c678dd; font-weight: bold; }\n.hljs-section, .hljs-name, .hljs-selector-tag, .hljs-deletion, .hljs-subst { color: #e06c75; }\n.hljs-literal { color: #56b6c2; }\n.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-meta .hljs-string { color: #98c379; }\n.hljs-built_in, .hljs-title.class_, .hljs-class .hljs-title { color: #e5c07b; }\n.hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-type, .hljs-selector-attr, .hljs-selector-pseudo, .hljs-number { color: #d19a66; }\n.hljs-symbol, .hljs-bullet, .hljs-link, .hljs-meta, .hljs-selector-id, .hljs-title, .hljs-title.function_ { color: #61aeee; }\n.hljs-emphasis { font-style: italic; }\n.hljs-strong { font-weight: bold; }\n";
|
|
15
|
+
export declare function getHighlightCss(themeName?: HighlightThemeName | string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Split highlighted HTML into lines while preserving open <span> context.
|
|
18
|
+
* Adapts doocs/md approach to ensure proper tag closures on every line.
|
|
19
|
+
*/
|
|
20
|
+
export declare function splitHighlightedHtmlByLines(html: string): string[];
|
|
21
|
+
/**
|
|
22
|
+
* Replaces tab indentation and leading/consecutive whitespace with ,
|
|
23
|
+
* ensuring indentation survives WeChat rich text sanitization while preserving
|
|
24
|
+
* standard single spaces between words for searchability.
|
|
25
|
+
*/
|
|
26
|
+
export declare function formatCodeLine(lineHtml: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Formats highlighted HTML into WeChat-bulletproof markup with explicit line breaks (<br/>)
|
|
29
|
+
* and non-breaking indentation spaces ( ) wrapped in a single block element,
|
|
30
|
+
* with optional line numbers column.
|
|
31
|
+
*/
|
|
32
|
+
export declare function formatHighlightedCode(rawHtml: string, showLineNumber?: boolean): string;
|
|
33
|
+
/**
|
|
34
|
+
* Highlights code using highlight.js with safe fallback to escaped plain text.
|
|
35
|
+
*/
|
|
36
|
+
export declare function highlightCode(code: string, rawLang?: string, showLineNumber?: boolean): {
|
|
37
|
+
highlighted: string;
|
|
38
|
+
language: string;
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=highlighter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlighter.d.ts","sourceRoot":"","sources":["../../src/plugins/highlighter.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,MAAM,kBAAkB,GAAG,eAAe,GAAG,cAAc,GAAG,SAAS,CAAC;AAE9E,eAAO,MAAM,cAAc,48BAY1B,CAAC;AAEF,eAAO,MAAM,cAAc,48BAY1B,CAAC;AAEF,eAAO,MAAM,UAAU,48BAYtB,CAAC;AAEF,eAAO,MAAM,gBAAgB,48BAAiB,CAAC;AAE/C,wBAAgB,eAAe,CAAC,SAAS,CAAC,EAAE,kBAAkB,GAAG,MAAM,GAAG,MAAM,CAU/E;AAWD;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAuClE;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAavD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,GAAE,OAAe,GAAG,MAAM,CAmB9F;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,EAChB,cAAc,GAAE,OAAe,GAC9B;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAwC3C"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Syntax Highlighting Plugin for WeChat Official Account Markdown Rendering.
|
|
4
|
+
*
|
|
5
|
+
* Inspired by and adapted from the open-source industry standard doocs/md:
|
|
6
|
+
* https://github.com/doocs/md (MIT License)
|
|
7
|
+
*
|
|
8
|
+
* Uses highlight.js for AST-level lexical highlighting, generating class-tagged
|
|
9
|
+
* spans that are subsequently inlined by Juice into safe, bulletproof WeChat inline styles.
|
|
10
|
+
*/
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.highlightBaseCss = exports.monokaiCss = exports.githubLightCss = exports.atomOneDarkCss = void 0;
|
|
16
|
+
exports.getHighlightCss = getHighlightCss;
|
|
17
|
+
exports.splitHighlightedHtmlByLines = splitHighlightedHtmlByLines;
|
|
18
|
+
exports.formatCodeLine = formatCodeLine;
|
|
19
|
+
exports.formatHighlightedCode = formatHighlightedCode;
|
|
20
|
+
exports.highlightCode = highlightCode;
|
|
21
|
+
const highlight_js_1 = __importDefault(require("highlight.js"));
|
|
22
|
+
exports.atomOneDarkCss = `
|
|
23
|
+
.markdown-body pre code.hljs, .mac-code-wrapper pre code.hljs, code.hljs, .hljs { color: #abb2bf; background: #282c34; background-color: #282c34; }
|
|
24
|
+
.hljs-comment, .hljs-quote { color: #5c6370; font-style: italic; }
|
|
25
|
+
.hljs-doctag, .hljs-keyword, .hljs-formula { color: #c678dd; font-weight: bold; }
|
|
26
|
+
.hljs-section, .hljs-name, .hljs-selector-tag, .hljs-deletion, .hljs-subst { color: #e06c75; }
|
|
27
|
+
.hljs-literal { color: #56b6c2; }
|
|
28
|
+
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-meta .hljs-string { color: #98c379; }
|
|
29
|
+
.hljs-built_in, .hljs-title.class_, .hljs-class .hljs-title { color: #e5c07b; }
|
|
30
|
+
.hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-type, .hljs-selector-attr, .hljs-selector-pseudo, .hljs-number { color: #d19a66; }
|
|
31
|
+
.hljs-symbol, .hljs-bullet, .hljs-link, .hljs-meta, .hljs-selector-id, .hljs-title, .hljs-title.function_ { color: #61aeee; }
|
|
32
|
+
.hljs-emphasis { font-style: italic; }
|
|
33
|
+
.hljs-strong { font-weight: bold; }
|
|
34
|
+
`;
|
|
35
|
+
exports.githubLightCss = `
|
|
36
|
+
.markdown-body pre code.hljs, .mac-code-wrapper pre code.hljs, code.hljs, .hljs { color: #24292e; background: #f6f8fa; background-color: #f6f8fa; }
|
|
37
|
+
.hljs-comment, .hljs-quote { color: #6a737d; font-style: italic; }
|
|
38
|
+
.hljs-doctag, .hljs-keyword, .hljs-formula { color: #d73a49; font-weight: bold; }
|
|
39
|
+
.hljs-section, .hljs-name, .hljs-selector-tag, .hljs-deletion, .hljs-subst { color: #d73a49; }
|
|
40
|
+
.hljs-literal { color: #005cc5; }
|
|
41
|
+
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-meta .hljs-string { color: #032f62; }
|
|
42
|
+
.hljs-built_in, .hljs-title.class_, .hljs-class .hljs-title { color: #6f42c1; }
|
|
43
|
+
.hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-type, .hljs-selector-attr, .hljs-selector-pseudo, .hljs-number { color: #e36209; }
|
|
44
|
+
.hljs-symbol, .hljs-bullet, .hljs-link, .hljs-meta, .hljs-selector-id, .hljs-title, .hljs-title.function_ { color: #005cc5; }
|
|
45
|
+
.hljs-emphasis { font-style: italic; }
|
|
46
|
+
.hljs-strong { font-weight: bold; }
|
|
47
|
+
`;
|
|
48
|
+
exports.monokaiCss = `
|
|
49
|
+
.markdown-body pre code.hljs, .mac-code-wrapper pre code.hljs, code.hljs, .hljs { color: #f8f8f2; background: #272822; background-color: #272822; }
|
|
50
|
+
.hljs-comment, .hljs-quote { color: #75715e; font-style: italic; }
|
|
51
|
+
.hljs-doctag, .hljs-keyword, .hljs-formula { color: #f92672; font-weight: bold; }
|
|
52
|
+
.hljs-section, .hljs-name, .hljs-selector-tag, .hljs-deletion, .hljs-subst { color: #f92672; }
|
|
53
|
+
.hljs-literal { color: #ae81ff; }
|
|
54
|
+
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-meta .hljs-string { color: #e6db74; }
|
|
55
|
+
.hljs-built_in, .hljs-title.class_, .hljs-class .hljs-title { color: #a6e22e; }
|
|
56
|
+
.hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-type, .hljs-selector-attr, .hljs-selector-pseudo, .hljs-number { color: #fd971f; }
|
|
57
|
+
.hljs-symbol, .hljs-bullet, .hljs-link, .hljs-meta, .hljs-selector-id, .hljs-title, .hljs-title.function_ { color: #66d9ef; }
|
|
58
|
+
.hljs-emphasis { font-style: italic; }
|
|
59
|
+
.hljs-strong { font-weight: bold; }
|
|
60
|
+
`;
|
|
61
|
+
exports.highlightBaseCss = exports.atomOneDarkCss;
|
|
62
|
+
function getHighlightCss(themeName) {
|
|
63
|
+
switch (themeName) {
|
|
64
|
+
case 'github-light':
|
|
65
|
+
return exports.githubLightCss;
|
|
66
|
+
case 'monokai':
|
|
67
|
+
return exports.monokaiCss;
|
|
68
|
+
case 'atom-one-dark':
|
|
69
|
+
default:
|
|
70
|
+
return exports.atomOneDarkCss;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function escapeHtml(text) {
|
|
74
|
+
return text
|
|
75
|
+
.replace(/&/g, '&')
|
|
76
|
+
.replace(/</g, '<')
|
|
77
|
+
.replace(/>/g, '>')
|
|
78
|
+
.replace(/"/g, '"')
|
|
79
|
+
.replace(/\x27/g, ''');
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Split highlighted HTML into lines while preserving open <span> context.
|
|
83
|
+
* Adapts doocs/md approach to ensure proper tag closures on every line.
|
|
84
|
+
*/
|
|
85
|
+
function splitHighlightedHtmlByLines(html) {
|
|
86
|
+
const lines = [];
|
|
87
|
+
let currentLine = '';
|
|
88
|
+
const openTags = [];
|
|
89
|
+
let i = 0;
|
|
90
|
+
while (i < html.length) {
|
|
91
|
+
if (html[i] === '<') {
|
|
92
|
+
let tag = '<';
|
|
93
|
+
i++;
|
|
94
|
+
while (i < html.length && html[i] !== '>') {
|
|
95
|
+
tag += html[i];
|
|
96
|
+
i++;
|
|
97
|
+
}
|
|
98
|
+
if (i < html.length) {
|
|
99
|
+
tag += '>';
|
|
100
|
+
i++;
|
|
101
|
+
}
|
|
102
|
+
currentLine += tag;
|
|
103
|
+
if (tag.startsWith('</span')) {
|
|
104
|
+
openTags.pop();
|
|
105
|
+
}
|
|
106
|
+
else if (tag.startsWith('<span')) {
|
|
107
|
+
openTags.push(tag);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else if (html[i] === '\n') {
|
|
111
|
+
const closingTags = '</span>'.repeat(openTags.length);
|
|
112
|
+
lines.push(currentLine + closingTags);
|
|
113
|
+
currentLine = openTags.join('');
|
|
114
|
+
i++;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
currentLine += html[i];
|
|
118
|
+
i++;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
lines.push(currentLine);
|
|
122
|
+
return lines;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Replaces tab indentation and leading/consecutive whitespace with ,
|
|
126
|
+
* ensuring indentation survives WeChat rich text sanitization while preserving
|
|
127
|
+
* standard single spaces between words for searchability.
|
|
128
|
+
*/
|
|
129
|
+
function formatCodeLine(lineHtml) {
|
|
130
|
+
let formatted = lineHtml.replace(/\t/g, ' ');
|
|
131
|
+
// Transform only the text content outside tags:
|
|
132
|
+
formatted = formatted.replace(/(<[^>]+>)|([^<]+)/g, (match, tag, text) => {
|
|
133
|
+
if (tag)
|
|
134
|
+
return tag;
|
|
135
|
+
return text.replace(/ {2,}/g, (m) => ' '.repeat(m.length));
|
|
136
|
+
});
|
|
137
|
+
// Match leading spaces, even if preceded by open tags like <span ...>
|
|
138
|
+
formatted = formatted.replace(/^((?:<[^>]+>)*)( +)/, (_, tags, spaces) => tags + ' '.repeat(spaces.length));
|
|
139
|
+
return formatted === '' ? ' ' : formatted;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Formats highlighted HTML into WeChat-bulletproof markup with explicit line breaks (<br/>)
|
|
143
|
+
* and non-breaking indentation spaces ( ) wrapped in a single block element,
|
|
144
|
+
* with optional line numbers column.
|
|
145
|
+
*/
|
|
146
|
+
function formatHighlightedCode(rawHtml, showLineNumber = false) {
|
|
147
|
+
const lines = splitHighlightedHtmlByLines(rawHtml).map(formatCodeLine);
|
|
148
|
+
if (showLineNumber && lines.length > 0) {
|
|
149
|
+
const lineNumbersHtml = lines
|
|
150
|
+
.map((_, idx) => `<span style="display: block; line-height: 1.6; padding: 0 8px 0 0; text-align: right;">${idx + 1}</span>`)
|
|
151
|
+
.join('');
|
|
152
|
+
const codeContentHtml = lines.join('<br/>');
|
|
153
|
+
return `
|
|
154
|
+
<span style="display: flex; align-items: flex-start; width: 100%; box-sizing: border-box;">
|
|
155
|
+
<span class="code-line-numbers" style="display: block; padding: 0 10px 0 0; border-right: 1px solid rgba(255, 255, 255, 0.1); user-select: none; color: #5c6370; font-size: inherit; font-family: inherit;">${lineNumbersHtml}</span>
|
|
156
|
+
<span class="code-scroll" style="display: block; flex: 1 1 auto; overflow-x: auto; padding-left: 12px; min-width: 0;">
|
|
157
|
+
<span class="code-block__inner" style="display: block;">${codeContentHtml}</span>
|
|
158
|
+
</span>
|
|
159
|
+
</span>`.trim();
|
|
160
|
+
}
|
|
161
|
+
return `<span class="code-block__inner" style="display: block;">${lines.join('<br/>')}</span>`;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Highlights code using highlight.js with safe fallback to escaped plain text.
|
|
165
|
+
*/
|
|
166
|
+
function highlightCode(code, rawLang, showLineNumber = false) {
|
|
167
|
+
const cleanLang = (rawLang || '')
|
|
168
|
+
.trim()
|
|
169
|
+
.toLowerCase()
|
|
170
|
+
.match(/^[a-zA-Z0-9_#+.-]+/)?.[0] || '';
|
|
171
|
+
const normalizedCode = code.replace(/\r\n?/g, '\n');
|
|
172
|
+
// Try explicit language match
|
|
173
|
+
if (cleanLang && highlight_js_1.default.getLanguage(cleanLang)) {
|
|
174
|
+
try {
|
|
175
|
+
const result = highlight_js_1.default.highlight(normalizedCode, { language: cleanLang, ignoreIllegals: true });
|
|
176
|
+
return {
|
|
177
|
+
highlighted: formatHighlightedCode(result.value, showLineNumber),
|
|
178
|
+
language: cleanLang,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
catch {
|
|
182
|
+
// Fallback
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// Automatic language detection if code is reasonably sized
|
|
186
|
+
if (!cleanLang && normalizedCode.length > 10) {
|
|
187
|
+
try {
|
|
188
|
+
const auto = highlight_js_1.default.highlightAuto(normalizedCode);
|
|
189
|
+
if (auto.language && auto.relevance > 3) {
|
|
190
|
+
return {
|
|
191
|
+
highlighted: formatHighlightedCode(auto.value, showLineNumber),
|
|
192
|
+
language: auto.language,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
catch {
|
|
197
|
+
// Fallback
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
highlighted: formatHighlightedCode(escapeHtml(normalizedCode), showLineNumber),
|
|
202
|
+
language: cleanLang || 'plaintext',
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=highlighter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlighter.js","sourceRoot":"","sources":["../../src/plugins/highlighter.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;;;;AAkDH,0CAUC;AAeD,kEAuCC;AAOD,wCAaC;AAOD,sDAmBC;AAKD,sCA4CC;AA/MD,gEAAgC;AAInB,QAAA,cAAc,GAAG;;;;;;;;;;;;CAY7B,CAAC;AAEW,QAAA,cAAc,GAAG;;;;;;;;;;;;CAY7B,CAAC;AAEW,QAAA,UAAU,GAAG;;;;;;;;;;;;CAYzB,CAAC;AAEW,QAAA,gBAAgB,GAAG,sBAAc,CAAC;AAE/C,SAAgB,eAAe,CAAC,SAAuC;IACrE,QAAQ,SAAS,EAAE,CAAC;QAClB,KAAK,cAAc;YACjB,OAAO,sBAAc,CAAC;QACxB,KAAK,SAAS;YACZ,OAAO,kBAAU,CAAC;QACpB,KAAK,eAAe,CAAC;QACrB;YACE,OAAO,sBAAc,CAAC;IAC1B,CAAC;AACH,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,IAAI;SACR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;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AAW;QACb,CAAC;IACH,CAAC;IAED,2DAA2D;IAC3D,IAAI,CAAC,SAAS,IAAI,cAAc,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QAC7C,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,sBAAI,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;YAChD,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE,CAAC;gBACxC,OAAO;oBACL,WAAW,EAAE,qBAAqB,CAAC,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC;oBAC9D,QAAQ,EAAE,IAAI,CAAC,QAAQ;iBACxB,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,WAAW;QACb,CAAC;IACH,CAAC;IAED,OAAO;QACL,WAAW,EAAE,qBAAqB,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;QAC9E,QAAQ,EAAE,SAAS,IAAI,WAAW;KACnC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image Figure and Caption Plugin for WeChat Official Accounts.
|
|
3
|
+
*
|
|
4
|
+
* Wraps Markdown images in dedicated figure containers and renders
|
|
5
|
+
* accessible, stylized captions from image title or alt attributes.
|
|
6
|
+
*/
|
|
7
|
+
export declare const imageFigureBaseCss = "\n.wm-image-figure {\n text-align: center !important;\n margin: 1.5em 0 !important;\n}\n\n.wm-image-figure img {\n max-width: 100%;\n height: auto;\n border-radius: 6px;\n display: block;\n margin: 0 auto;\n}\n\n.wm-image-caption {\n display: block !important;\n text-align: center !important;\n font-size: 13px !important;\n color: #888888 !important;\n margin-top: 6px !important;\n line-height: 1.5 !important;\n}\n";
|
|
8
|
+
export declare function processImageFigures(html: string, enabled?: boolean): string;
|
|
9
|
+
//# sourceMappingURL=image-figure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-figure.d.ts","sourceRoot":"","sources":["../../src/plugins/image-figure.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,kBAAkB,obAsB9B,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,OAAc,GAAG,MAAM,CAsBjF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Image Figure and Caption Plugin for WeChat Official Accounts.
|
|
4
|
+
*
|
|
5
|
+
* Wraps Markdown images in dedicated figure containers and renders
|
|
6
|
+
* accessible, stylized captions from image title or alt attributes.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.imageFigureBaseCss = void 0;
|
|
10
|
+
exports.processImageFigures = processImageFigures;
|
|
11
|
+
exports.imageFigureBaseCss = `
|
|
12
|
+
.wm-image-figure {
|
|
13
|
+
text-align: center !important;
|
|
14
|
+
margin: 1.5em 0 !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.wm-image-figure img {
|
|
18
|
+
max-width: 100%;
|
|
19
|
+
height: auto;
|
|
20
|
+
border-radius: 6px;
|
|
21
|
+
display: block;
|
|
22
|
+
margin: 0 auto;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.wm-image-caption {
|
|
26
|
+
display: block !important;
|
|
27
|
+
text-align: center !important;
|
|
28
|
+
font-size: 13px !important;
|
|
29
|
+
color: #888888 !important;
|
|
30
|
+
margin-top: 6px !important;
|
|
31
|
+
line-height: 1.5 !important;
|
|
32
|
+
}
|
|
33
|
+
`;
|
|
34
|
+
function processImageFigures(html, enabled = true) {
|
|
35
|
+
if (!enabled) {
|
|
36
|
+
return html;
|
|
37
|
+
}
|
|
38
|
+
// Find paragraphs that contain only an image: <p><img ...></p>
|
|
39
|
+
// Avoid formulas and mermaid figures that already have special classes
|
|
40
|
+
const pImgRegex = /<p>(\s*<img\b(?![^>]*(?:wm-formula|wm-mermaid))[^>]*src="([^"]+)"[^>]*>)\s*<\/p>/gi;
|
|
41
|
+
return html.replace(pImgRegex, (match, fullImgTag) => {
|
|
42
|
+
// Extract title or alt
|
|
43
|
+
const titleMatch = fullImgTag.match(/\btitle="([^"]+)"/i);
|
|
44
|
+
const altMatch = fullImgTag.match(/\balt="([^"]+)"/i);
|
|
45
|
+
const captionText = titleMatch?.[1] || altMatch?.[1];
|
|
46
|
+
if (captionText && captionText.trim() && !captionText.includes('http')) {
|
|
47
|
+
return `<p class="wm-image-figure">${fullImgTag}<span class="wm-image-caption">${captionText.trim()}</span></p>`;
|
|
48
|
+
}
|
|
49
|
+
return `<p class="wm-image-figure">${fullImgTag}</p>`;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=image-figure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-figure.js","sourceRoot":"","sources":["../../src/plugins/image-figure.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA0BH,kDAsBC;AA9CY,QAAA,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;CAsBjC,CAAC;AAEF,SAAgB,mBAAmB,CAAC,IAAY,EAAE,UAAmB,IAAI;IACvE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAED,+DAA+D;IAC/D,uEAAuE;IACvE,MAAM,SAAS,GACb,oFAAoF,CAAC;IAEvF,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;QACnD,uBAAuB;QACvB,MAAM,UAAU,GAAG,UAAU,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAC1D,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACtD,MAAM,WAAW,GAAG,UAAU,EAAE,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC;QAErD,IAAI,WAAW,IAAI,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YACvE,OAAO,8BAA8B,UAAU,kCAAkC,WAAW,CAAC,IAAI,EAAE,aAAa,CAAC;QACnH,CAAC;QAED,OAAO,8BAA8B,UAAU,MAAM,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GFM Task List / Checkbox Transformer for WeChat Official Accounts.
|
|
3
|
+
*
|
|
4
|
+
* Replaces <input type="checkbox"> with bulletproof WeChat inline elements
|
|
5
|
+
* that survive WeChat sanitizer tag stripping.
|
|
6
|
+
*/
|
|
7
|
+
export declare const taskListBaseCss = "\n.task-list-item {\n list-style-type: none !important;\n margin-left: -14px !important;\n}\n\n.task-checkbox-checked {\n display: inline-block;\n width: 15px;\n height: 15px;\n line-height: 15px;\n text-align: center;\n background-color: #07c160;\n color: #ffffff;\n border-radius: 3px;\n font-size: 11px;\n font-weight: bold;\n margin-right: 6px;\n vertical-align: middle;\n}\n\n.task-checkbox-unchecked {\n display: inline-block;\n width: 13px;\n height: 13px;\n border: 1.5px solid #888888;\n border-radius: 3px;\n margin-right: 6px;\n vertical-align: middle;\n}\n";
|
|
8
|
+
export declare function processTaskLists(html: string, enabled?: boolean): string;
|
|
9
|
+
//# sourceMappingURL=task-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-list.d.ts","sourceRoot":"","sources":["../../src/plugins/task-list.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,eAAe,klBA8B3B,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,OAAc,GAAG,MAAM,CAwB9E"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GFM Task List / Checkbox Transformer for WeChat Official Accounts.
|
|
4
|
+
*
|
|
5
|
+
* Replaces <input type="checkbox"> with bulletproof WeChat inline elements
|
|
6
|
+
* that survive WeChat sanitizer tag stripping.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.taskListBaseCss = void 0;
|
|
10
|
+
exports.processTaskLists = processTaskLists;
|
|
11
|
+
exports.taskListBaseCss = `
|
|
12
|
+
.task-list-item {
|
|
13
|
+
list-style-type: none !important;
|
|
14
|
+
margin-left: -14px !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.task-checkbox-checked {
|
|
18
|
+
display: inline-block;
|
|
19
|
+
width: 15px;
|
|
20
|
+
height: 15px;
|
|
21
|
+
line-height: 15px;
|
|
22
|
+
text-align: center;
|
|
23
|
+
background-color: #07c160;
|
|
24
|
+
color: #ffffff;
|
|
25
|
+
border-radius: 3px;
|
|
26
|
+
font-size: 11px;
|
|
27
|
+
font-weight: bold;
|
|
28
|
+
margin-right: 6px;
|
|
29
|
+
vertical-align: middle;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.task-checkbox-unchecked {
|
|
33
|
+
display: inline-block;
|
|
34
|
+
width: 13px;
|
|
35
|
+
height: 13px;
|
|
36
|
+
border: 1.5px solid #888888;
|
|
37
|
+
border-radius: 3px;
|
|
38
|
+
margin-right: 6px;
|
|
39
|
+
vertical-align: middle;
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
42
|
+
function processTaskLists(html, enabled = true) {
|
|
43
|
+
if (!enabled) {
|
|
44
|
+
return html;
|
|
45
|
+
}
|
|
46
|
+
// 1. Replace checked inputs: <input checked="" disabled="" type="checkbox"> or variations
|
|
47
|
+
const checkedRegex = /<input\b[^>]*?(?:checked(?:="[^"]*")?)[^>]*?type="checkbox"[^>]*>/gi;
|
|
48
|
+
const reverseCheckedRegex = /<input\b[^>]*?type="checkbox"[^>]*?(?:checked(?:="[^"]*")?)[^>]*>/gi;
|
|
49
|
+
let processed = html
|
|
50
|
+
.replace(checkedRegex, `<span class="task-checkbox-checked">✓</span>`)
|
|
51
|
+
.replace(reverseCheckedRegex, `<span class="task-checkbox-checked">✓</span>`);
|
|
52
|
+
// 2. Replace remaining unchecked inputs
|
|
53
|
+
const uncheckedRegex = /<input\b[^>]*?type="checkbox"[^>]*>/gi;
|
|
54
|
+
processed = processed.replace(uncheckedRegex, `<span class="task-checkbox-unchecked"></span>`);
|
|
55
|
+
// 3. Mark parent li with task-list-item class to remove default bullet
|
|
56
|
+
processed = processed.replace(/<li>(\s*<span class="task-checkbox-(?:checked|unchecked)">)/g, `<li class="task-list-item">$1`);
|
|
57
|
+
return processed;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=task-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-list.js","sourceRoot":"","sources":["../../src/plugins/task-list.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAkCH,4CAwBC;AAxDY,QAAA,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8B9B,CAAC;AAEF,SAAgB,gBAAgB,CAAC,IAAY,EAAE,UAAmB,IAAI;IACpE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAED,0FAA0F;IAC1F,MAAM,YAAY,GAAG,qEAAqE,CAAC;IAC3F,MAAM,mBAAmB,GAAG,qEAAqE,CAAC;IAElG,IAAI,SAAS,GAAG,IAAI;SACjB,OAAO,CAAC,YAAY,EAAE,8CAA8C,CAAC;SACrE,OAAO,CAAC,mBAAmB,EAAE,8CAA8C,CAAC,CAAC;IAEhF,wCAAwC;IACxC,MAAM,cAAc,GAAG,uCAAuC,CAAC;IAC/D,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC,cAAc,EAAE,+CAA+C,CAAC,CAAC;IAE/F,uEAAuE;IACvE,SAAS,GAAG,SAAS,CAAC,OAAO,CAC3B,8DAA8D,EAC9D,+BAA+B,CAChC,CAAC;IAEF,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/themes/geek.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const geekTheme = "\n.markdown-body {\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, monospace, sans-serif;\n font-size: 15px;\n line-height: 1.78;\n color: #24292f;\n word-break: break-word;\n padding: 0 4px;\n}\n\n.markdown-body p {\n margin: 1.1em 0;\n}\n\n.markdown-body h1 {\n font-size: 1.4em;\n font-weight: 800;\n color: #1f2328;\n margin: 1.8em 0 0.8em;\n padding-bottom: 0.3em;\n border-bottom: 2px solid #fd7e14;\n}\n\n.markdown-body h2 {\n font-size: 1.25em;\n font-weight: 800;\n color: #1f2328;\n margin: 1.5em 0 0.7em;\n padding-left: 10px;\n border-left: 4px solid #fd7e14;\n}\n\n.markdown-body h3 {\n font-size: 1.1em;\n font-weight: 700;\n color: #d9480f;\n margin: 1.2em 0 0.5em;\n}\n\n.markdown-body strong {\n font-weight: 700;\n color: #d9480f;\n}\n\n.markdown-body blockquote {\n margin: 1.2em 0;\n padding: 12px 16px;\n color: #495057;\n background-color: #fff9db;\n border-left: 4px solid #fd7e14;\n border-radius: 4px;\n}\n\n.markdown-body code {\n font-family: Menlo, Monaco, Consolas, monospace;\n font-size: 0.88em;\n background-color: #f1f3f5;\n color: #d6336c;\n padding: 2px 6px;\n border-radius: 4px;\n}\n\n.markdown-body pre {\n font-family: Menlo, Monaco, Consolas, monospace;\n font-size: 0.85em;\n background-color: #181a1b;\n color: #f8f9fa;\n padding: 14px 16px;\n border-radius: 6px;\n overflow-x: auto;\n margin: 1.2em 0;\n}\n\n.markdown-body table {\n width: 100%;\n border-collapse: collapse;\n margin: 1.2em 0;\n font-size: 0.9em;\n}\n\n.markdown-body th {\n background-color: #f8f9fa;\n color: #212529;\n font-weight: 700;\n padding: 8px 12px;\n border: 1px solid #dee2e6;\n}\n\n.markdown-body td {\n padding: 8px 12px;\n border: 1px solid #dee2e6;\n}\n\n.table-scroller {\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n margin: 1.2em 0;\n}\n\n.footnote-ref {\n color: #d9480f;\n font-size: 0.8em;\n vertical-align: super;\n font-weight: 600;\n}\n\n.footnotes-container {\n margin-top: 2.5em;\n padding-top: 1.2em;\n border-top: 1px dashed #ced4da;\n font-size: 0.85em;\n color: #6c757d;\n}\n\n.footnotes-title {\n font-size: 1.05em;\n font-weight: 700;\n color: #d9480f;\n margin-bottom: 0.8em;\n}\n\n/* Alerts -- must match the .markdown-body blockquote.gfm-alert* shape of\n alertsBaseCss (specificity 0,2,1). A bare .gfm-alert-note (0,1,0) would\n lose to the base layer and to .markdown-body blockquote above.\n Saturated hues to match the theme's high-contrast palette; WARNING sits on\n orange rather than the house yellow so it cannot be mistaken for a plain\n blockquote. The .gfm-alert fallback deliberately mirrors the plain\n blockquote: it is unreachable while all five types match, and an unknown\n future type should degrade to the theme's own quote look. */\n.markdown-body blockquote.gfm-alert {\n margin: 1.2em 0;\n padding: 12px 16px;\n border-left: 4px solid #fd7e14;\n border-radius: 4px;\n background-color: #fff9db;\n}\n\n.markdown-body blockquote.gfm-alert-note { border-left-color: #1c7ed6; background-color: #e7f5ff; }\n.markdown-body blockquote.gfm-alert-tip { border-left-color: #2f9e44; background-color: #ebfbee; }\n.markdown-body blockquote.gfm-alert-important { border-left-color: #7048e8; background-color: #f3f0ff; }\n.markdown-body blockquote.gfm-alert-warning { border-left-color: #f76707; background-color: #fff4e6; }\n.markdown-body blockquote.gfm-alert-caution { border-left-color: #e03131; background-color: #fff5f5; }\n";
|
|
1
|
+
export declare const geekTheme = "\n.markdown-body {\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, monospace, sans-serif;\n font-size: 15px;\n line-height: 1.78;\n color: #24292f;\n word-break: break-word;\n padding: 0 4px;\n}\n\n.markdown-body p {\n margin: 1.1em 0;\n}\n\n.markdown-body h1 {\n font-size: 1.4em;\n font-weight: 800;\n color: #1f2328;\n margin: 1.8em 0 0.8em;\n padding-bottom: 0.3em;\n border-bottom: 2px solid #fd7e14;\n}\n\n.markdown-body h2 {\n font-size: 1.25em;\n font-weight: 800;\n color: #1f2328;\n margin: 1.5em 0 0.7em;\n padding-left: 10px;\n border-left: 4px solid #fd7e14;\n}\n\n.markdown-body h3 {\n font-size: 1.1em;\n font-weight: 700;\n color: #d9480f;\n margin: 1.2em 0 0.5em;\n}\n\n.markdown-body strong {\n font-weight: 700;\n color: #d9480f;\n}\n\n.markdown-body blockquote {\n margin: 1.2em 0;\n padding: 12px 16px;\n color: #495057;\n background-color: #fff9db;\n border-left: 4px solid #fd7e14;\n border-radius: 4px;\n}\n\n.markdown-body code {\n font-family: Menlo, Monaco, Consolas, monospace;\n font-size: 0.88em;\n background-color: #f1f3f5;\n color: #d6336c;\n padding: 2px 6px;\n border-radius: 4px;\n}\n\n.markdown-body pre {\n font-family: Menlo, Monaco, Consolas, monospace;\n font-size: 0.85em;\n background-color: #181a1b;\n color: #f8f9fa;\n padding: 14px 16px;\n border-radius: 6px;\n overflow-x: auto;\n white-space: pre !important;\n word-break: normal !important;\n word-wrap: normal !important;\n display: block !important;\n -webkit-overflow-scrolling: touch;\n margin: 1.2em 0;\n}\n\n.markdown-body pre code {\n background: transparent;\n color: inherit;\n padding: 0 !important;\n border: none !important;\n font-size: inherit !important;\n display: block !important;\n white-space: pre !important;\n word-break: normal !important;\n word-wrap: normal !important;\n}\n\n.markdown-body table {\n width: 100%;\n border-collapse: collapse;\n margin: 1.2em 0;\n font-size: 0.9em;\n}\n\n.markdown-body th {\n background-color: #f8f9fa;\n color: #212529;\n font-weight: 700;\n padding: 8px 12px;\n border: 1px solid #dee2e6;\n}\n\n.markdown-body td {\n padding: 8px 12px;\n border: 1px solid #dee2e6;\n}\n\n.table-scroller {\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n margin: 1.2em 0;\n}\n\n.footnote-ref {\n color: #d9480f;\n font-size: 0.8em;\n vertical-align: super;\n font-weight: 600;\n}\n\n.footnotes-container {\n margin-top: 2.5em;\n padding-top: 1.2em;\n border-top: 1px dashed #ced4da;\n font-size: 0.85em;\n color: #6c757d;\n}\n\n.footnotes-title {\n font-size: 1.05em;\n font-weight: 700;\n color: #d9480f;\n margin-bottom: 0.8em;\n}\n\n/* Alerts -- must match the .markdown-body blockquote.gfm-alert* shape of\n alertsBaseCss (specificity 0,2,1). A bare .gfm-alert-note (0,1,0) would\n lose to the base layer and to .markdown-body blockquote above.\n Saturated hues to match the theme's high-contrast palette; WARNING sits on\n orange rather than the house yellow so it cannot be mistaken for a plain\n blockquote. The .gfm-alert fallback deliberately mirrors the plain\n blockquote: it is unreachable while all five types match, and an unknown\n future type should degrade to the theme's own quote look. */\n.markdown-body blockquote.gfm-alert {\n margin: 1.2em 0;\n padding: 12px 16px;\n border-left: 4px solid #fd7e14;\n border-radius: 4px;\n background-color: #fff9db;\n}\n\n.markdown-body blockquote.gfm-alert-note { border-left-color: #1c7ed6; background-color: #e7f5ff; }\n.markdown-body blockquote.gfm-alert-tip { border-left-color: #2f9e44; background-color: #ebfbee; }\n.markdown-body blockquote.gfm-alert-important { border-left-color: #7048e8; background-color: #f3f0ff; }\n.markdown-body blockquote.gfm-alert-warning { border-left-color: #f76707; background-color: #fff4e6; }\n.markdown-body blockquote.gfm-alert-caution { border-left-color: #e03131; background-color: #fff5f5; }\n";
|
|
2
2
|
//# sourceMappingURL=geek.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geek.d.ts","sourceRoot":"","sources":["../../src/themes/geek.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"geek.d.ts","sourceRoot":"","sources":["../../src/themes/geek.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,64HA+JrB,CAAC"}
|