@entropicwarrior/sdoc 0.1.8 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/sdoc.js +28 -1
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.8",
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 `<pre class="sdoc-code"${dl}><code${langClass}>${escapeHtml(node.text)}</code></pre>`;
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 "";
@@ -1879,10 +1879,37 @@ const DEFAULT_STYLE = `
1879
1879
  `;
1880
1880
 
1881
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
+ }
1882
1906
  @media print {
1883
1907
  html {
1884
1908
  font-size: 80%;
1885
1909
  }
1910
+ .sdoc-copy-btn {
1911
+ display: none;
1912
+ }
1886
1913
  body {
1887
1914
  height: auto;
1888
1915
  overflow: visible;