@cfbender/cesium 0.6.2 → 0.7.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/CHANGELOG.md +82 -1
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/prompt/system-fragment.md +68 -8
- package/src/render/annotate-frozen.ts +90 -0
- package/src/render/blocks/render.ts +20 -0
- package/src/render/blocks/renderers/callout.ts +3 -2
- package/src/render/blocks/renderers/code.ts +17 -2
- package/src/render/blocks/renderers/compare-table.ts +3 -2
- package/src/render/blocks/renderers/diagram.ts +3 -2
- package/src/render/blocks/renderers/diff.ts +23 -9
- package/src/render/blocks/renderers/hero.ts +3 -2
- package/src/render/blocks/renderers/kv.ts +3 -2
- package/src/render/blocks/renderers/list.ts +5 -4
- package/src/render/blocks/renderers/pill-row.ts +3 -2
- package/src/render/blocks/renderers/prose.ts +8 -2
- package/src/render/blocks/renderers/raw-html.ts +8 -2
- package/src/render/blocks/renderers/risk-table.ts +3 -2
- package/src/render/blocks/renderers/section.ts +4 -2
- package/src/render/blocks/renderers/timeline.ts +3 -2
- package/src/render/blocks/renderers/tldr.ts +3 -2
- package/src/render/client-js.ts +804 -6
- package/src/render/critique.ts +5 -335
- package/src/render/theme.ts +431 -6
- package/src/render/validate.ts +353 -97
- package/src/render/wrap.ts +67 -9
- package/src/server/api.ts +162 -3
- package/src/storage/index-gen.ts +4 -2
- package/src/storage/mutate.ts +433 -27
- package/src/tools/annotate.ts +336 -0
- package/src/tools/ask.ts +2 -6
- package/src/tools/critique.ts +15 -45
- package/src/tools/publish.ts +16 -56
- package/src/tools/styleguide.ts +7 -1
- package/src/tools/wait.ts +77 -24
|
@@ -4,10 +4,16 @@
|
|
|
4
4
|
import type { ProseBlock } from "../types.ts";
|
|
5
5
|
import type { BlockMeta } from "../types.ts";
|
|
6
6
|
import type { RenderCtx } from "../render.ts";
|
|
7
|
+
import { anchorAttr } from "../render.ts";
|
|
7
8
|
import { renderMarkdown } from "../markdown.ts";
|
|
8
9
|
|
|
9
|
-
export function renderProse(block: ProseBlock,
|
|
10
|
-
|
|
10
|
+
export function renderProse(block: ProseBlock, ctx: RenderCtx): string {
|
|
11
|
+
const markdown = renderMarkdown(block.markdown);
|
|
12
|
+
const anchor = anchorAttr(ctx);
|
|
13
|
+
if (anchor === "") return markdown;
|
|
14
|
+
// Inject the anchor attribute into the outermost element's opening tag.
|
|
15
|
+
// renderMarkdown produces HTML starting with a tag like <p>, <ul>, <ol>, <blockquote>, <hr>.
|
|
16
|
+
return markdown.replace(/^(<\w+)/, `$1${anchor}`);
|
|
11
17
|
}
|
|
12
18
|
|
|
13
19
|
export const meta: BlockMeta = {
|
|
@@ -4,11 +4,17 @@
|
|
|
4
4
|
import type { RawHtmlBlock } from "../types.ts";
|
|
5
5
|
import type { BlockMeta } from "../types.ts";
|
|
6
6
|
import type { RenderCtx } from "../render.ts";
|
|
7
|
+
import { anchorAttr } from "../render.ts";
|
|
7
8
|
import { scrub } from "../../scrub.ts";
|
|
8
9
|
|
|
9
|
-
export function renderRawHtml(block: RawHtmlBlock,
|
|
10
|
+
export function renderRawHtml(block: RawHtmlBlock, ctx: RenderCtx): string {
|
|
10
11
|
const scrubResult = scrub(block.html);
|
|
11
|
-
|
|
12
|
+
const html = scrubResult.html;
|
|
13
|
+
const anchor = anchorAttr(ctx);
|
|
14
|
+
if (anchor === "") return html;
|
|
15
|
+
// Inject anchor into the outermost element's opening tag.
|
|
16
|
+
// The scrubbed payload starts with an element tag (e.g. <div, <p, <table, etc.).
|
|
17
|
+
return html.replace(/^(<\w+)/, `$1${anchor}`);
|
|
12
18
|
}
|
|
13
19
|
|
|
14
20
|
export const meta: BlockMeta = {
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
import type { RiskTableBlock } from "../types.ts";
|
|
5
5
|
import type { BlockMeta } from "../types.ts";
|
|
6
6
|
import type { RenderCtx } from "../render.ts";
|
|
7
|
+
import { anchorAttr } from "../render.ts";
|
|
7
8
|
import { escapeHtml } from "../escape.ts";
|
|
8
9
|
|
|
9
|
-
export function renderRiskTable(block: RiskTableBlock,
|
|
10
|
+
export function renderRiskTable(block: RiskTableBlock, ctx: RenderCtx): string {
|
|
10
11
|
const headerRow =
|
|
11
12
|
" <thead>\n <tr>\n" +
|
|
12
13
|
" <th>Risk</th>\n <th>Likelihood</th>\n <th>Impact</th>\n <th>Mitigation</th>\n" +
|
|
@@ -26,7 +27,7 @@ export function renderRiskTable(block: RiskTableBlock, _ctx: RenderCtx): string
|
|
|
26
27
|
.join("\n");
|
|
27
28
|
|
|
28
29
|
return (
|
|
29
|
-
`<table class="risk-table">\n` +
|
|
30
|
+
`<table class="risk-table"${anchorAttr(ctx)}>\n` +
|
|
30
31
|
`${headerRow}\n` +
|
|
31
32
|
` <tbody>\n${bodyRows}\n </tbody>\n` +
|
|
32
33
|
`</table>`
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { SectionBlock } from "../types.ts";
|
|
5
5
|
import type { BlockMeta } from "../types.ts";
|
|
6
6
|
import type { RenderCtx } from "../render.ts";
|
|
7
|
-
import { renderBlock } from "../render.ts";
|
|
7
|
+
import { renderBlock, anchorAttr } from "../render.ts";
|
|
8
8
|
import { escapeHtml } from "../escape.ts";
|
|
9
9
|
|
|
10
10
|
export async function renderSection(block: SectionBlock, ctx: RenderCtx): Promise<string> {
|
|
@@ -30,11 +30,13 @@ export async function renderSection(block: SectionBlock, ctx: RenderCtx): Promis
|
|
|
30
30
|
// Render children with incremented depth.
|
|
31
31
|
// Non-section children are grouped into <div class="card"> wrappers for visual polish.
|
|
32
32
|
// Nested section children are emitted at top level (they carry their own card structure).
|
|
33
|
+
// anchor: null — child blocks do not get their own block-N anchors; only the section is anchored.
|
|
33
34
|
const childCtx: RenderCtx = {
|
|
34
35
|
sectionCounter: ctx.sectionCounter,
|
|
35
36
|
depth: ctx.depth + 1,
|
|
36
37
|
path: `${ctx.path}.children`,
|
|
37
38
|
highlightTheme: ctx.highlightTheme,
|
|
39
|
+
anchor: null,
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
let buffer: string[] = [];
|
|
@@ -65,7 +67,7 @@ export async function renderSection(block: SectionBlock, ctx: RenderCtx): Promis
|
|
|
65
67
|
parts.push(` <div class="card">\n${buffer.join("\n")}\n </div>`);
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
return `<section>\n${parts.join("\n")}\n</section>`;
|
|
70
|
+
return `<section${anchorAttr(ctx)}>\n${parts.join("\n")}\n</section>`;
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
export const meta: BlockMeta = {
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
import type { TimelineBlock } from "../types.ts";
|
|
5
5
|
import type { BlockMeta } from "../types.ts";
|
|
6
6
|
import type { RenderCtx } from "../render.ts";
|
|
7
|
+
import { anchorAttr } from "../render.ts";
|
|
7
8
|
import { escapeHtml } from "../escape.ts";
|
|
8
9
|
|
|
9
|
-
export function renderTimeline(block: TimelineBlock,
|
|
10
|
+
export function renderTimeline(block: TimelineBlock, ctx: RenderCtx): string {
|
|
10
11
|
const items = block.items
|
|
11
12
|
.map((item) => {
|
|
12
13
|
const dateHtml =
|
|
@@ -22,7 +23,7 @@ export function renderTimeline(block: TimelineBlock, _ctx: RenderCtx): string {
|
|
|
22
23
|
})
|
|
23
24
|
.join("\n");
|
|
24
25
|
|
|
25
|
-
return `<ul class="timeline">\n${items}\n</ul>`;
|
|
26
|
+
return `<ul class="timeline"${anchorAttr(ctx)}>\n${items}\n</ul>`;
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export const meta: BlockMeta = {
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
import type { TldrBlock } from "../types.ts";
|
|
5
5
|
import type { BlockMeta } from "../types.ts";
|
|
6
6
|
import type { RenderCtx } from "../render.ts";
|
|
7
|
+
import { anchorAttr } from "../render.ts";
|
|
7
8
|
import { renderMarkdown } from "../markdown.ts";
|
|
8
9
|
|
|
9
|
-
export function renderTldr(block: TldrBlock,
|
|
10
|
-
return `<aside class="tldr">\n${renderMarkdown(block.markdown)}\n</aside>`;
|
|
10
|
+
export function renderTldr(block: TldrBlock, ctx: RenderCtx): string {
|
|
11
|
+
return `<aside class="tldr"${anchorAttr(ctx)}>\n${renderMarkdown(block.markdown)}\n</aside>`;
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export const meta: BlockMeta = {
|