docnest 0.1.22 → 0.1.23
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 +2 -0
- package/dist/server.js +10 -4
- package/package.json +1 -1
- package/server/static/css/styles.css +3 -0
- package/server/static/css/themes.css +1 -1
package/README.md
CHANGED
package/dist/server.js
CHANGED
|
@@ -188,10 +188,6 @@ const md = new MarkdownIt({
|
|
|
188
188
|
linkify: true,
|
|
189
189
|
typographer: true,
|
|
190
190
|
highlight: function (str, lang) {
|
|
191
|
-
// 特殊处理 Mermaid 图表
|
|
192
|
-
if (lang === 'mermaid') {
|
|
193
|
-
return `<div class="mermaid">${str}</div>`;
|
|
194
|
-
}
|
|
195
191
|
// 其他代码块使用 highlight.js
|
|
196
192
|
if (lang && hljs.getLanguage(lang)) {
|
|
197
193
|
try {
|
|
@@ -202,6 +198,16 @@ const md = new MarkdownIt({
|
|
|
202
198
|
return `<pre class="hljs"><code>${md.utils.escapeHtml(str)}</code></pre>`;
|
|
203
199
|
},
|
|
204
200
|
});
|
|
201
|
+
// Mermaid is a diagram, not highlighted code. A code/pre ancestor changes
|
|
202
|
+
// the inherited font after Mermaid measures HTML labels, clipping their text.
|
|
203
|
+
const renderCodeFence = md.renderer.rules.fence;
|
|
204
|
+
md.renderer.rules.fence = function (tokens, index, options, env, renderer) {
|
|
205
|
+
const token = tokens[index];
|
|
206
|
+
if (token.info.trim().split(/\s+/)[0] === 'mermaid') {
|
|
207
|
+
return `<div class="mermaid">${md.utils.escapeHtml(token.content)}</div>\n`;
|
|
208
|
+
}
|
|
209
|
+
return renderCodeFence(tokens, index, options, env, renderer);
|
|
210
|
+
};
|
|
205
211
|
function slugifyHeading(text) {
|
|
206
212
|
return (text || '')
|
|
207
213
|
.replace(/`([^`]+)`/g, '$1')
|
package/package.json
CHANGED
|
@@ -1339,6 +1339,9 @@ body[data-theme="dark"] .not-found-path {
|
|
|
1339
1339
|
|
|
1340
1340
|
/* Mermaid 图表样式 */
|
|
1341
1341
|
.markdown-body .mermaid {
|
|
1342
|
+
/* Match Mermaid's measurement fallback when a diagram font is omitted or
|
|
1343
|
+
rejected by its directive sanitizer. Explicit SVG fonts still take priority. */
|
|
1344
|
+
font-family: "trebuchet ms", verdana, arial, sans-serif;
|
|
1342
1345
|
margin: 24px 0;
|
|
1343
1346
|
text-align: center;
|
|
1344
1347
|
background: var(--linear-bg-subtle);
|
|
@@ -89,7 +89,7 @@ html.docnest-restricted .markdown-body .mermaid-download-btn {
|
|
|
89
89
|
color: var(--linear-text, rgba(15, 23, 42, 0.42));
|
|
90
90
|
font: 700 clamp(0.75rem, 1.5vw, 1.5rem)/1 var(--doc-font-mono);
|
|
91
91
|
letter-spacing: 0.08em;
|
|
92
|
-
opacity: 0.
|
|
92
|
+
opacity: 0.04;
|
|
93
93
|
transform: rotate(-24deg);
|
|
94
94
|
white-space: nowrap;
|
|
95
95
|
}
|