@skeudo/html 0.0.0-stage → 0.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 The Skeudo authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,62 @@
1
- # Temporary Holding Version
1
+ # @skeudo/html
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ > **Alpha.** The format and this API will change in ways that break existing sketches and code. Until 1.0, breaking changes come in minor versions (0.1 to 0.2), never in patches, and the [release notes](https://github.com/wlezzar/skeudo/releases) list each one.
4
+
5
+ Renders [Skeudo](https://github.com/wlezzar/skeudo) sketches as HTML. A sketch is pseudocode for code review where every outside effect is tagged, or a data model drawn as tables and a story of how their rows change, and its first line says which: `view: code` or `view: data`. The format is defined in [spec/spec.md](https://github.com/wlezzar/skeudo/blob/main/spec/spec.md).
6
+
7
+ For Markdown, use [`markdown-it-skeudo`](https://www.npmjs.com/package/markdown-it-skeudo) or [`remark-skeudo`](https://www.npmjs.com/package/remark-skeudo), which call this package. To render whole pages from the command line, use the [`skeudo`](https://www.npmjs.com/package/skeudo) CLI.
8
+
9
+ ```sh
10
+ npm install @skeudo/html
11
+ ```
12
+
13
+ ## Use
14
+
15
+ ```js
16
+ import { toHtml } from '@skeudo/html';
17
+
18
+ const html = toHtml(`view: code
19
+ get_user(id):
20
+ row = find(id) ::read:postgres.users
21
+ return row
22
+ `);
23
+ ```
24
+
25
+ `toHtml` takes a sketch's source text or a sketch parsed by [`@skeudo/core`](https://www.npmjs.com/package/@skeudo/core), and returns one element: `div.sketch` for a code sketch, `div.skd` for a data sketch. `toHast` returns the same element as a [hast](https://github.com/syntax-tree/hast) tree, for unified pipelines and MDX. Neither touches the DOM, so both run in Node and in the browser.
26
+
27
+ The page needs two more things:
28
+
29
+ - **The stylesheet**, `@skeudo/html/skeudo.css`. Import it from a bundler (`import '@skeudo/html/skeudo.css'`), or copy `node_modules/@skeudo/html/dist/skeudo.css` next to your page.
30
+ - **`enhance()`**, called once in the browser. It wires the interaction: hovering a name highlights its other uses and clicking pins them, explanations from `::doc` show in a popover, blocks fold and unfold by their chevron, with a folded line showing the tags of the lines under it, and data sketches step through their story by click or with the arrow keys. It watches the page, so sketches added later, as when a single-page site changes page, work too, and a sketch rendered again, as a live preview does on each edit, keeps its step and its blocks as the reader left them. Without it, explanations are the browser's tooltips, every block shows open and a data sketch shows its last step.
31
+
32
+ ```js
33
+ import { enhance } from '@skeudo/html';
34
+
35
+ enhance(document); // returns a function that removes its listeners
36
+ ```
37
+
38
+ Sketches follow the reader's light or dark mode. A page with a theme switch sets `data-theme="light"` or `data-theme="dark"` on its `html` element, as Docusaurus and Starlight do.
39
+
40
+ ## Options
41
+
42
+ `toHtml(source, options)` and `toHast(source, options)` take:
43
+
44
+ | Option | Default | |
45
+ | --- | --- | --- |
46
+ | `srcHref` | links to `::repo` | Builds a link for a `::src` location, from `{ path, start, end }` and the parsed sketch. `srcBaseHref(base)` builds one for a base URL, such as `https://github.com/org/repo/blob/a1b2c3d/`. Without it, a sketch that names its repository with `::repo` links to the file there, on GitHub, GitLab or Bitbucket, and other locations are tooltips. |
47
+ | `gitHosts` | `{}` | Other GitHub, GitLab or Bitbucket servers, such as `{ 'git.example.com': 'gitlab' }`, so `::repo` links reach them too. |
48
+ | `kindColors` | `{}` | CSS colors for tag kinds, such as `{ todo: '#8b5cf6' }`. |
49
+ | `labelKinds` | `['untrusted', 'secret']` | Tag kinds whose value labels a variable. Every later use of a labeled variable is marked. |
50
+
51
+ The data view takes no options.
52
+
53
+ ## Other exports
54
+
55
+ - `tagHtml(tag, options)` and `tagHast(tag, options)` render one tag as a pill, as the Markdown plugins do for inline code such as `` `::read:postgres.users` ``.
56
+ - `repoHref(repo, location, gitHosts)` is the default link for a `::src` location in a sketch with `::repo`.
57
+ - `unfoldTo(row)` opens the folded blocks around a line's row, for a page that scrolls to a line, as the playground's review panel does. It needs `enhance()`.
58
+ - `escapeHtml(text)`.
59
+
60
+ ## License
61
+
62
+ MIT
@@ -0,0 +1,7 @@
1
+ /** Variable highlighting, explanations and folding for the code sketches under `root`. */
2
+ export declare function enhanceCode(root: HTMLElement | Document): () => void;
3
+ /**
4
+ * Unfolds the blocks around a row of a code sketch, so the row shows, as clicks on their chevrons would,
5
+ * so enhance() remembers them open.
6
+ */
7
+ export declare function unfoldTo(row: Element): void;
@@ -0,0 +1,290 @@
1
+ /*
2
+ * Interaction for rendered code sketches, wired by enhance() in index.ts.
3
+ */
4
+ import { Popover, POPOVER_DELAY } from '../shared/popover.js';
5
+ /** Variable highlighting, explanations and folding for the code sketches under `root`. */
6
+ export function enhanceCode(root) {
7
+ const off = [highlightVariables(root), showDocs(root), folding(root)];
8
+ return () => off.forEach((remove) => remove());
9
+ }
10
+ function highlightVariables(root) {
11
+ const target = (e) => e.target?.closest?.('[data-var]') ?? null;
12
+ const mark = (el, cls, on) => {
13
+ const name = el.getAttribute('data-var');
14
+ const scope = el.closest('[data-sketch], [data-sketch-scope]') ?? root;
15
+ scope.querySelectorAll(`[data-var="${CSS.escape(name)}"]`).forEach((n) => n.classList.toggle(cls, on));
16
+ };
17
+ const over = (e) => {
18
+ const el = target(e);
19
+ if (el)
20
+ mark(el, 'sk-hl', true);
21
+ };
22
+ const out = (e) => {
23
+ const el = target(e);
24
+ if (el)
25
+ mark(el, 'sk-hl', false);
26
+ };
27
+ const click = (e) => {
28
+ const el = target(e);
29
+ if (el && !el.closest('a'))
30
+ mark(el, 'sk-pin', !el.classList.contains('sk-pin'));
31
+ };
32
+ root.addEventListener('mouseover', over);
33
+ root.addEventListener('mouseout', out);
34
+ root.addEventListener('click', click);
35
+ return () => {
36
+ root.removeEventListener('mouseover', over);
37
+ root.removeEventListener('mouseout', out);
38
+ root.removeEventListener('click', click);
39
+ };
40
+ }
41
+ /** A sketch row's depth, from the `--d` its style sets. */
42
+ const rowDepth = (row) => Number(row.style.getPropertyValue('--d')) || 0;
43
+ /** Each foldable header of a code sketch, with a key that finds it again when the sketch is rendered again: its code, and which of the headers with that code it is. */
44
+ function foldableRows(sketch) {
45
+ const seen = new Map();
46
+ return [...sketch.querySelectorAll('.sk-foldable')].map((row) => {
47
+ const code = row.querySelector('.sk-code')?.textContent ?? '';
48
+ const n = (seen.get(code) ?? 0) + 1;
49
+ seen.set(code, n);
50
+ return { key: `${code}\u0000${n}`, row };
51
+ });
52
+ }
53
+ /**
54
+ * Folding. The chevron on a block header folds or unfolds its block, and clicking a folded line's
55
+ * summary unfolds it. The renderer marks which lines start folded and hidden; code.css acts on those
56
+ * marks only under `sk-folding`, which this puts on the root, so a page without enhance() shows every line.
57
+ */
58
+ function folding(root) {
59
+ const host = root instanceof Document ? root.documentElement : root;
60
+ host.classList.add('sk-folding');
61
+ const win = (root instanceof Document ? root : root.ownerDocument).defaultView;
62
+ const address = () => (win ? win.location.pathname + win.location.search : '');
63
+ let page = address();
64
+ /**
65
+ * The blocks the reader folded or opened, by the sketch's position under root and the header's key,
66
+ * with whether the markup started the block folded. A preview that renders the page again on each edit,
67
+ * as VS Code's does, then keeps each block as the reader left it, unless the edit added or removed its
68
+ * `::fold`. It is forgotten when the page's address changes, as for the steps of data sketches.
69
+ */
70
+ const remembered = new Map();
71
+ const sketches = () => [...root.querySelectorAll('[data-sketch]')];
72
+ /** Puts back the blocks of each sketch not seen yet as the reader left them, and remembers how its markup starts them. */
73
+ function start() {
74
+ if (address() !== page) {
75
+ remembered.clear();
76
+ page = address();
77
+ }
78
+ sketches().forEach((sketch, i) => {
79
+ if (sketch.hasAttribute('data-sk-live'))
80
+ return;
81
+ sketch.setAttribute('data-sk-live', '');
82
+ const before = remembered.get(i);
83
+ const now = new Map();
84
+ for (const { key, row } of foldableRows(sketch)) {
85
+ const markup = row.classList.contains('sk-folded');
86
+ const left = before?.get(key);
87
+ const folded = left && left.markup === markup ? left.folded : markup;
88
+ if (folded !== markup)
89
+ setFolded(row, folded);
90
+ now.set(key, { folded, markup });
91
+ }
92
+ remembered.set(i, now);
93
+ });
94
+ }
95
+ const click = (e) => {
96
+ // A variable in a summary, as in `← body`, pins its highlight instead.
97
+ if (e.target?.closest?.('[data-var]'))
98
+ return;
99
+ const el = e.target?.closest?.('.sk-fold, .sk-folded > .sk-tags > .sk-rollup');
100
+ const row = el?.closest('.sk-row');
101
+ const sketch = row?.closest('[data-sketch]');
102
+ if (!row || !sketch)
103
+ return;
104
+ e.preventDefault();
105
+ const folded = !row.classList.contains('sk-folded');
106
+ setFolded(row, folded);
107
+ const entry = remembered.get(sketches().indexOf(sketch))?.get(foldableRows(sketch).find((r) => r.row === row)?.key ?? '');
108
+ if (entry)
109
+ entry.folded = folded;
110
+ };
111
+ start();
112
+ const observer = new MutationObserver(start);
113
+ observer.observe(host, { childList: true, subtree: true });
114
+ root.addEventListener('click', click);
115
+ return () => {
116
+ observer.disconnect();
117
+ host.classList.remove('sk-folding');
118
+ root.removeEventListener('click', click);
119
+ };
120
+ }
121
+ function setFolded(row, folded) {
122
+ row.classList.toggle('sk-folded', folded);
123
+ const button = row.querySelector('.sk-fold');
124
+ button?.setAttribute('aria-expanded', String(!folded));
125
+ button?.setAttribute('aria-label', folded ? 'Unfold block' : 'Fold block');
126
+ if (row.parentElement)
127
+ hideFolded(row.parentElement);
128
+ }
129
+ /**
130
+ * Hides the lines inside folded blocks, and shows the others, as the renderer does for the blocks that
131
+ * start folded. A blank line takes the depth of the shallower line around it, so one inside a block is
132
+ * hidden with it.
133
+ */
134
+ function hideFolded(lines) {
135
+ let foldDepth = -1;
136
+ for (const row of lines.children) {
137
+ const depth = rowDepth(row);
138
+ const hidden = foldDepth >= 0 && depth > foldDepth;
139
+ row.classList.toggle('sk-hide', hidden);
140
+ if (!hidden)
141
+ foldDepth = row.classList.contains('sk-folded') ? depth : -1;
142
+ }
143
+ }
144
+ /**
145
+ * Unfolds the blocks around a row of a code sketch, so the row shows, as clicks on their chevrons would,
146
+ * so enhance() remembers them open.
147
+ */
148
+ export function unfoldTo(row) {
149
+ let depth = rowDepth(row);
150
+ for (let r = row.previousElementSibling; r && depth > 0; r = r.previousElementSibling) {
151
+ if (r.classList.contains('sk-blank') || rowDepth(r) >= depth)
152
+ continue;
153
+ depth = rowDepth(r);
154
+ if (r.classList.contains('sk-folded'))
155
+ r.querySelector('.sk-fold')?.click();
156
+ }
157
+ }
158
+ /**
159
+ * Shows the explanation of a call or a line in a popover. The popover sits on the page's body with a
160
+ * fixed position, since the sketch's box scrolls and would cut it off. It stands in for the element's
161
+ * tooltip, which is removed while the pointer or focus is on the element and put back after.
162
+ */
163
+ function showDocs(root) {
164
+ const doc = root instanceof Document ? root : root.ownerDocument;
165
+ const win = doc.defaultView;
166
+ const pop = new Popover(doc);
167
+ /** The element whose explanation is shown, or is about to be. */
168
+ let anchor;
169
+ /** The anchor's tooltip, while it is removed. */
170
+ let title = null;
171
+ let timer;
172
+ const target = (e) => e.target?.closest?.('[data-doc]') ?? null;
173
+ /** The rows a line's explanation covers: the line, and the lines of its block when it is a header. */
174
+ function scope(el) {
175
+ const row = el.classList.contains('sk-code') ? el.closest('.sk-row') : null;
176
+ if (!row?.classList.contains('sk-header'))
177
+ return [];
178
+ const rows = [row];
179
+ const depth = rowDepth(row);
180
+ for (let r = row.nextElementSibling; r && rowDepth(r) > depth; r = r.nextElementSibling)
181
+ rows.push(r);
182
+ return rows;
183
+ }
184
+ /** Under the line, so it doesn't cover it. A call's explanation starts at the call, a line's where its text starts. */
185
+ function place(el) {
186
+ const start = el.classList.contains('sk-code')
187
+ ? ([...el.children].find((c) => !c.classList.contains('sk-x') && !c.classList.contains('sk-doc-mark')) ?? el)
188
+ : el;
189
+ pop.below((el.closest('.sk-row') ?? el).getBoundingClientRect(), start.getBoundingClientRect().left);
190
+ }
191
+ function show() {
192
+ clearTimeout(timer);
193
+ timer = undefined;
194
+ if (!anchor)
195
+ return;
196
+ const text = anchor.getAttribute('data-doc') ?? '';
197
+ // The rest of the tooltip, such as where a call is defined, goes under the explanation.
198
+ const rest = title?.startsWith(text) ? title.slice(text.length).trim() : '';
199
+ const main = doc.createElement('div');
200
+ main.className = 'sk-doc-text';
201
+ main.textContent = text;
202
+ const content = [main];
203
+ if (rest) {
204
+ const info = doc.createElement('div');
205
+ info.className = 'sk-doc-info';
206
+ info.textContent = rest;
207
+ content.push(info);
208
+ }
209
+ pop.show(content);
210
+ place(anchor);
211
+ anchor.setAttribute('aria-describedby', pop.id);
212
+ for (const row of scope(anchor))
213
+ row.classList.add('sk-doc-scope');
214
+ }
215
+ function hide() {
216
+ clearTimeout(timer);
217
+ timer = undefined;
218
+ if (anchor) {
219
+ if (title !== null)
220
+ anchor.setAttribute('title', title);
221
+ anchor.removeAttribute('aria-describedby');
222
+ for (const row of scope(anchor))
223
+ row.classList.remove('sk-doc-scope');
224
+ }
225
+ anchor = undefined;
226
+ title = null;
227
+ pop.hide();
228
+ }
229
+ function start(el, delay) {
230
+ if (el === anchor) {
231
+ // Focus on an element the pointer is resting on shows its explanation without waiting.
232
+ if (timer !== undefined && !delay)
233
+ show();
234
+ return;
235
+ }
236
+ hide();
237
+ anchor = el;
238
+ // Removed now, so the browser never shows the tooltip as well.
239
+ title = el.getAttribute('title');
240
+ el.removeAttribute('title');
241
+ if (delay)
242
+ timer = setTimeout(show, delay);
243
+ else
244
+ show();
245
+ }
246
+ const over = (e) => {
247
+ const el = target(e);
248
+ if (el)
249
+ start(el, POPOVER_DELAY);
250
+ // The sketch was rendered again under the pointer, as VS Code's preview does on each edit.
251
+ else if (anchor && !anchor.isConnected)
252
+ hide();
253
+ };
254
+ const out = (e) => {
255
+ if (anchor && !anchor.contains(e.relatedTarget))
256
+ hide();
257
+ };
258
+ const focusIn = (e) => {
259
+ const el = target(e);
260
+ if (el)
261
+ start(el, 0);
262
+ };
263
+ const focusOut = (e) => {
264
+ if (anchor && anchor.contains(e.target))
265
+ hide();
266
+ };
267
+ const key = (e) => {
268
+ if (e.key === 'Escape')
269
+ hide();
270
+ };
271
+ root.addEventListener('mouseover', over);
272
+ root.addEventListener('mouseout', out);
273
+ root.addEventListener('focusin', focusIn);
274
+ root.addEventListener('focusout', focusOut);
275
+ root.addEventListener('keydown', key);
276
+ // The popover doesn't move with the page, so it goes away when anything scrolls.
277
+ win?.addEventListener('scroll', hide, true);
278
+ win?.addEventListener('resize', hide);
279
+ return () => {
280
+ hide();
281
+ pop.remove();
282
+ root.removeEventListener('mouseover', over);
283
+ root.removeEventListener('mouseout', out);
284
+ root.removeEventListener('focusin', focusIn);
285
+ root.removeEventListener('focusout', focusOut);
286
+ root.removeEventListener('keydown', key);
287
+ win?.removeEventListener('scroll', hide, true);
288
+ win?.removeEventListener('resize', hide);
289
+ };
290
+ }
@@ -0,0 +1,20 @@
1
+ import type { Repo, ResolvedSrc } from '@skeudo/core';
2
+ /** A link for a source location, with a note for its tooltip, such as a warning that the lines may have moved. */
3
+ export interface SrcLink {
4
+ href: string;
5
+ note?: string;
6
+ }
7
+ /** The kinds of code hosts repoHref can link to. */
8
+ export type GitHost = 'github' | 'gitlab' | 'bitbucket';
9
+ /**
10
+ * A `srcHref` that links source locations under a base URL, such as a GitHub blob URL at a commit
11
+ * (`https://github.com/org/repo/blob/a1b2c3d/`). Lines become a fragment, as in `#L88-L94`.
12
+ */
13
+ export declare function srcBaseHref(base: string): (loc: ResolvedSrc) => string | undefined;
14
+ /**
15
+ * Links a source location to the repository a sketch names with `::repo`. A remote on GitHub, GitLab or
16
+ * Bitbucket links to the file on that host at the revision, or at the default branch without one; give
17
+ * other servers of those kinds in `hosts`. A `git+file://` folder links with a `file://` URL, and any
18
+ * other URL is a base that the path is added to. Returns undefined for a host it doesn't know.
19
+ */
20
+ export declare function repoHref(repo: Repo, loc: ResolvedSrc, hosts?: Record<string, GitHost>): string | undefined;
@@ -0,0 +1,45 @@
1
+ /** A path in a URL, each part escaped. */
2
+ const encodePath = (path) => path.split('/').map(encodeURIComponent).join('/');
3
+ /** A location's path, without a leading `./`. */
4
+ const relativePath = (loc) => loc.path.replace(/^(\.?\/)+/, '');
5
+ /** The lines of a location as a URL fragment, in the form each host reads: `#L88-L94`, `#L88-94` or `#lines-88:94`. */
6
+ function linesFragment(loc, host = 'github') {
7
+ if (loc.start === undefined)
8
+ return '';
9
+ const end = loc.end !== undefined && loc.end !== loc.start ? loc.end : undefined;
10
+ if (host === 'bitbucket')
11
+ return `#lines-${loc.start}${end === undefined ? '' : `:${end}`}`;
12
+ return `#L${loc.start}${end === undefined ? '' : host === 'gitlab' ? `-${end}` : `-L${end}`}`;
13
+ }
14
+ /**
15
+ * A `srcHref` that links source locations under a base URL, such as a GitHub blob URL at a commit
16
+ * (`https://github.com/org/repo/blob/a1b2c3d/`). Lines become a fragment, as in `#L88-L94`.
17
+ */
18
+ export function srcBaseHref(base) {
19
+ const root = base.endsWith('/') ? base : `${base}/`;
20
+ return (loc) => (loc.path ? root + encodePath(relativePath(loc)) + linesFragment(loc) : undefined);
21
+ }
22
+ const KNOWN_HOSTS = { 'github.com': 'github', 'gitlab.com': 'gitlab', 'bitbucket.org': 'bitbucket' };
23
+ /**
24
+ * Links a source location to the repository a sketch names with `::repo`. A remote on GitHub, GitLab or
25
+ * Bitbucket links to the file on that host at the revision, or at the default branch without one; give
26
+ * other servers of those kinds in `hosts`. A `git+file://` folder links with a `file://` URL, and any
27
+ * other URL is a base that the path is added to. Returns undefined for a host it doesn't know.
28
+ */
29
+ export function repoHref(repo, loc, hosts = {}) {
30
+ if (!loc.path)
31
+ return undefined;
32
+ if (repo.type === 'base')
33
+ return srcBaseHref(repo.url)(loc);
34
+ if (repo.type === 'local') {
35
+ // Keep a Windows drive, as in `file:///C:/code`, unescaped.
36
+ const folder = repo.path.split('/').map((part, i) => (i === 0 && /^[a-z]:$/i.test(part) ? part : encodeURIComponent(part)));
37
+ return srcBaseHref(`file://${repo.path.startsWith('/') ? '' : '/'}${folder.join('/')}`)(loc);
38
+ }
39
+ const host = hosts[repo.host] ?? KNOWN_HOSTS[repo.host];
40
+ if (!host)
41
+ return undefined;
42
+ const rev = encodePath(repo.rev ?? 'HEAD');
43
+ const view = host === 'github' ? 'blob' : host === 'gitlab' ? '-/blob' : 'src';
44
+ return `https://${repo.host}/${encodePath(repo.path)}/${view}/${rev}/${encodePath(relativePath(loc))}${linesFragment(loc, host)}`;
45
+ }
@@ -0,0 +1,21 @@
1
+ import { type CodeSketch, type ParseOptions, type ResolvedSrc, type Tag } from '@skeudo/core';
2
+ import type { Element as HastElement } from 'hast';
3
+ import { type GitHost, type SrcLink } from './links.ts';
4
+ /** Options for rendering code sketches. */
5
+ export interface CodeHtmlOptions extends ParseOptions {
6
+ /**
7
+ * Builds a link for a source location in a sketch. Return undefined to show the location as a tooltip
8
+ * only. Defaults to repoHref, which links to the repository the sketch names with `::repo`.
9
+ */
10
+ srcHref?: (loc: ResolvedSrc, sketch: CodeSketch) => string | SrcLink | undefined;
11
+ /** Hosts of other GitHub, GitLab or Bitbucket servers, such as `{ 'git.example.com': 'gitlab' }`, for repoHref. */
12
+ gitHosts?: Record<string, GitHost>;
13
+ /** CSS colors for tag kinds, such as `{ todo: '#8b5cf6' }`. Overrides the defaults. */
14
+ kindColors?: Record<string, string>;
15
+ }
16
+ /** Builds one tag as a pill followed by its note, as a hast element. */
17
+ export declare function tagHast(tag: Tag, opts?: CodeHtmlOptions): HastElement;
18
+ /** Renders one tag as a pill, followed by its note. */
19
+ export declare function tagHtml(tag: Tag, opts?: CodeHtmlOptions): string;
20
+ /** Builds a code sketch as a hast tree: one `div.sketch` element. */
21
+ export declare function codeToHast(sketch: CodeSketch, opts?: CodeHtmlOptions): HastElement;