@entropicwarrior/sdoc 0.1.7 → 0.1.9
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/package.json +1 -1
- package/src/sdoc.js +35 -2
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@entropicwarrior/sdoc",
|
|
3
3
|
"displayName": "SDOC",
|
|
4
4
|
"description": "A plain-text documentation format with explicit brace scoping — deterministic parsing, AI-agent efficiency, and 10-50x token savings vs Markdown.",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.9",
|
|
6
6
|
"publisher": "entropicwarrior",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|
package/src/sdoc.js
CHANGED
|
@@ -1453,7 +1453,7 @@ function renderNode(node, depth) {
|
|
|
1453
1453
|
return `<pre class="mermaid"${dl}>${escapeHtml(node.text)}</pre>`;
|
|
1454
1454
|
}
|
|
1455
1455
|
const langClass = node.lang ? ` class="language-${escapeAttr(node.lang)}"` : "";
|
|
1456
|
-
return `<
|
|
1456
|
+
return `<div class="sdoc-code-wrap"${dl}><pre class="sdoc-code"><code${langClass}>${escapeHtml(node.text)}</code></pre><button class="sdoc-copy-btn" title="Copy code">\u29C9</button></div>`;
|
|
1457
1457
|
}
|
|
1458
1458
|
default:
|
|
1459
1459
|
return "";
|
|
@@ -1876,7 +1876,40 @@ const DEFAULT_STYLE = `
|
|
|
1876
1876
|
padding-left: 1.2rem;
|
|
1877
1877
|
}
|
|
1878
1878
|
|
|
1879
|
+
`;
|
|
1880
|
+
|
|
1881
|
+
const PRINT_STYLE = `
|
|
1882
|
+
.sdoc-code-wrap {
|
|
1883
|
+
position: relative;
|
|
1884
|
+
}
|
|
1885
|
+
.sdoc-copy-btn {
|
|
1886
|
+
position: absolute;
|
|
1887
|
+
top: 6px;
|
|
1888
|
+
right: 6px;
|
|
1889
|
+
z-index: 1;
|
|
1890
|
+
background: transparent;
|
|
1891
|
+
border: none;
|
|
1892
|
+
border-radius: 4px;
|
|
1893
|
+
cursor: pointer;
|
|
1894
|
+
font-size: 0.85rem;
|
|
1895
|
+
line-height: 1;
|
|
1896
|
+
padding: 2px 6px;
|
|
1897
|
+
opacity: 0;
|
|
1898
|
+
transition: opacity 0.15s;
|
|
1899
|
+
}
|
|
1900
|
+
.sdoc-code-wrap:hover .sdoc-copy-btn {
|
|
1901
|
+
opacity: 0.75;
|
|
1902
|
+
}
|
|
1903
|
+
.sdoc-copy-btn:hover {
|
|
1904
|
+
opacity: 1 !important;
|
|
1905
|
+
}
|
|
1879
1906
|
@media print {
|
|
1907
|
+
html {
|
|
1908
|
+
font-size: 80%;
|
|
1909
|
+
}
|
|
1910
|
+
.sdoc-copy-btn {
|
|
1911
|
+
display: none;
|
|
1912
|
+
}
|
|
1880
1913
|
body {
|
|
1881
1914
|
height: auto;
|
|
1882
1915
|
overflow: visible;
|
|
@@ -1942,7 +1975,7 @@ function renderHtmlDocumentFromParsed(parsed, title, options = {}) {
|
|
|
1942
1975
|
const footerContent = [footerHtml, companyHtml].filter(Boolean).join("\n");
|
|
1943
1976
|
|
|
1944
1977
|
const cssBase = options.cssOverride ?? DEFAULT_STYLE;
|
|
1945
|
-
const cssAppend = options.cssAppend ? `\n${options.cssAppend}` :
|
|
1978
|
+
const cssAppend = options.cssAppend ? `\n${options.cssAppend}\n${PRINT_STYLE}` : `\n${PRINT_STYLE}`;
|
|
1946
1979
|
const scriptTag = options.script ? `\n<script>${options.script}</script>` : "";
|
|
1947
1980
|
const mermaidScript = hasMermaidBlocks(parsed.nodes)
|
|
1948
1981
|
? `\n<script src="${MERMAID_CDN}"></script>\n<script>mermaid.initialize({startOnLoad:true,theme:"neutral",themeCSS:".node rect, .node polygon, .node circle { rx: 4; ry: 4; }"});</script>`
|