Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(ok): stop the WYSIWYG lint callout from covering the caret (PRD-8038) (#3587)

serafin-garciab9119365f6c0
diff --git a/.changeset/lint-callout-clears-the-cursor.md b/.changeset/lint-callout-clears-the-cursor.md
new file mode 100644
index 000000000..6d140f2f7
--- /dev/null
+++ b/.changeset/lint-callout-clears-the-cursor.md
@@ -0,0 +1,7 @@
+---
+"@inkeep/open-knowledge": patch
+---
+
+The markdown lint hover callout in the WYSIWYG editor no longer covers the line you are typing on. It used to land on that line itself, clipping a few pixels of an ordinary paragraph and most of the line on a tall block such as a Callout, where it also swallowed the click you would use to move the cursor. It now clears the whole line under the pointer and sits above the text instead of on it. On a block that carries no text of its own, such as a divider or an image, it used to lose its anchor completely and park in the top-left corner of the window, and it now sits just above the block it describes.
+
+The callout also had no way to close other than moving the mouse off the block or clicking Fix. Resting the pointer on a lint-decorated block and typing left it standing over your text indefinitely, through typing, arrow keys, and Escape alike. Any keypress in the editor now retires it, and moving the mouse brings it back. The Problems panel remains the keyboard route to the same diagnostics and fixes.
diff --git a/knip.config.ts b/knip.config.ts
index 78162ec09..f9179f2d4 100644
--- a/knip.config.ts
+++ b/knip.config.ts
@@ -123,7 +123,9 @@ export default {
'packages/server': {
entry: ['src/**/*.test.ts', 'src/parse-worker.ts'],
project: 'src/**',
- ignoreDependencies: ['@types/shell-quote'],
+ ignoreDependencies: [
+ '@types/shell-quote',
+ ],
},
'packages/cli': {
entry: ['src/**/*.test.ts', 'scripts/*.ts', 'tests/**/*.ts', 'src/parse-worker.ts'],
diff --git a/packages/app/src/editor/extensions/markdown-lint-decorations.test.ts b/packages/app/src/editor/extensions/markdown-lint-decorations.test.ts
index 1f8ff76ba..8ffc4354d 100644
--- a/packages/app/src/editor/extensions/markdown-lint-decorations.test.ts
+++ b/packages/app/src/editor/extensions/markdown-lint-decorations.test.ts
@@ -408,6 +408,104 @@ describe('Problems-row navigation — scroll suppression', () => {
});
});
+describe('hover callout — keyboard dismissal unwinds the pointer grace', () => {
+ const DOC = 'lint-tooltip-doc';
+ const BODY = '# Heading\n\nfirst paragraph\n\n\tindented with a hard tab\n';
+ const ENABLED_CONFIG: LinterConfig = {
+ enabled: true,
+ plugins: {
+ ...DEFAULT_LINTER_CONFIG.plugins,
+ markdownlint: { enabled: true, rules: { default: true } },
+ },
+ };
+ let editor: Editor | null = null;
+ let host: HTMLElement | null = null;
+ let originalFetch: typeof globalThis.fetch;
+ let originalElementFromPoint: PropertyDescriptor | undefined;
+
+ beforeEach(() => {
+ originalFetch = globalThis.fetch;
+ globalThis.fetch = vi.fn(async () =>
+ Response.json({ effective: ENABLED_CONFIG }),
+ ) as unknown as typeof fetch;
+ // The anchor computation hit-tests the pointer against the document, which
+ // jsdom does not implement. Answering outside the editor takes the callout's
+ // documented fallback (anchor to the block's own box) without needing the
+ // text-node geometry jsdom also omits — the dismissal wiring under test
+ // does not depend on which anchor was chosen.
+ originalElementFromPoint = Object.getOwnPropertyDescriptor(
+ Document.prototype,
+ 'elementFromPoint',
+ );
+ Object.defineProperty(Document.prototype, 'elementFromPoint', {
+ value: () => document.body,
+ configurable: true,
+ writable: true,
+ });
+ host = document.createElement('div');
+ document.body.appendChild(host);
+ editor = new Editor({
+ element: host,
+ extensions: [
+ ...coreExtensions,
+ MarkdownLintDecorations.configure({ docName: DOC, getSource: () => BODY }),
+ ],
+ content: md.parse(BODY),
+ });
+ });
+
+ afterEach(() => {
+ editor?.destroy();
+ editor = null;
+ host?.remove();
+ host = null;
+ if (originalElementFromPoint) {
+ Object.defineProperty(Document.prototype, 'elementFromPoint', originalElementFromPoint);
+ } else {
+ Reflect.deleteProperty(Document.prototype, 'elementFromPoint');
+ }
+ globalThis.fetch = originalFetch;
+ });
+
+ /** jsdom has no PointerEvent; the handlers read only MouseEvent fields. */
+ function pointer(type: string, init: MouseEventInit = {}): MouseEvent {
+ return new MouseEvent(type, { bubbles: true, ...init });
+ }
+
+ test('a keydown taken with the pointer on the callout leaves the next hide working', async () => {
+ const ed = editor;
+ const mount = host;
+ if (!ed || !mount) throw new Error('editor not mounted');
+ await vi.waitFor(() => expect(mount.querySelectorAll('.ok-lint-block').length).toBe(1), {
+ timeout: 5_000,
+ });
+ const block = mount.querySelector('.ok-lint-block') as HTMLElement;
+ // The callout is body-appended rather than mounted under the editor, so a
+ // leaked one from an earlier mount would be indistinguishable here.
+ const callouts = document.querySelectorAll<HTMLElement>('.ok-lint-tooltip');
+ expect(callouts).toHaveLength(1);
+ const tooltip = callouts[0] as HTMLElement;
+
+ block.dispatchEvent(pointer('pointerover'));
+ expect(tooltip.hidden).toBe(false);
+
+ // The pointer travels onto the callout so its Fix button stays reachable.
+ // That grace suppresses the hide timer, so a dismissal has to unwind it:
+ // once hidden the callout is no longer hit-testable, and an engine that
+ // withholds the matching `pointerleave` would leave the grace latched.
+ tooltip.dispatchEvent(new MouseEvent('pointerenter'));
+ ed.view.dom.dispatchEvent(new KeyboardEvent('keydown', { key: 'a', bubbles: true }));
+ expect(tooltip.hidden).toBe(true);
+
+ // Hover-to-read still works after the dismissal, and walking away from the
+ // block must retire what it raised.
+ block.dispatchEvent(pointer('pointerover'));
+ expect(tooltip.hidden).toBe(false);
+ ed.view.dom.dispatchEvent(pointer('pointerout', { relatedTarget: document.body }));
+ await vi.waitFor(() => expect(tooltip.hidden).toBe(true), { timeout: 2_000 });
+ });
+});
+
describe('decoration recovery after a content-equal rebuild', () => {
const DOC = 'lint-rebuild-doc';
/** The hard tab trips MD010 — the same body-anchored rule the e2e fixtures use. */
diff --git a/packages/app/src/editor/extensions/markdown-lint-decorations.ts b/packages/app/src/editor/extensions/markdown-lint-decorations.ts
index 73e989685..f4df1460b 100644
--- a/packages/app/src/editor/extensions/markdown-lint-decorations.ts
+++ b/packages/app/src/editor/extensions/markdown-lint-decorations.ts
@@ -43,7 +43,7 @@ import { t } from '@lingui/core/macro';
import { Extension } from '@tiptap/core';
import type { Node as PmNode } from '@tiptap/pm/model';
import { Plugin, PluginKey, TextSelection } from '@tiptap/pm/state';
-import { Decoration, DecorationSet } from '@tiptap/pm/view';
+import { Decoration, DecorationSet, type EditorView } from '@tiptap/pm/view';
import { LINT_NAV_EVENT, type LintNavDetail } from '@/components/ProblemsPanel';
import { buttonVariants } from '@/components/ui/button';
import { collectFixes, LINT_SOURCE_FIXED_EVENT } from '@/editor/apply-lint-fix';
@@ -162,9 +162,13 @@ function buildDecorationSet(
* a Fix button (mouse-only convenience — the Problems panel is the
* keyboard-accessible fix path). The tooltip stays open while the pointer is
* over it so the button is reachable.
+ *
+ * Mouse-only is enforced rather than merely documented: any keydown in the
+ * editor retires the tooltip, so an overlay raised by a resting pointer can
+ * never stand over the region the user has started typing in.
*/
function createLintTooltip(
- view: { dom: HTMLElement },
+ view: EditorView,
opts: {
getFixes: (block: HTMLElement) => LintTextEdit[];
applyFix?: (fixes: LintTextEdit[]) => void;
@@ -192,7 +196,8 @@ function createLintTooltip(
fixButton.hidden = true;
tooltip.appendChild(fixButton);
// Body-appended, viewport-fixed: positioned by floating-ui against a virtual
- // reference at the pointer (below), so it survives editor scroll containers.
+ // reference built from the hovered line (below), so it survives editor scroll
+ // containers.
tooltip.style.position = 'fixed';
tooltip.style.top = '0';
tooltip.style.left = '0';
@@ -202,22 +207,26 @@ function createLintTooltip(
let overTooltip = false;
let hideTimer: ReturnType<typeof setTimeout> | null = null;
let stopAutoUpdate: (() => void) | null = null;
- // Anchor point for positioning — the pointer location where the tooltip was
- // shown. Anchoring to the cursor (not the block's top-left corner) keeps the
- // tooltip next to the text the user is hovering, even in a tall block.
+ // Anchor for positioning: the pointer's x, but the full vertical extent of
+ // the text line under it. Keeping the pointer's x holds the tooltip next to
+ // the text being hovered (not at the block's top-left corner) even in a tall
+ // block, while the line's height is what `offset()` measures its clearance
+ // from — a zero-height reference clears the pointer POINT, which sits inside
+ // the line the caret is on, so the box lands on top of the text being edited.
let anchorX = 0;
- let anchorY = 0;
+ let anchorTop = 0;
+ let anchorBottom = 0;
const virtualEl = {
getBoundingClientRect: () =>
({
width: 0,
- height: 0,
+ height: anchorBottom - anchorTop,
x: anchorX,
- y: anchorY,
- top: anchorY,
+ y: anchorTop,
+ top: anchorTop,
left: anchorX,
right: anchorX,
- bottom: anchorY,
+ bottom: anchorBottom,
}) as DOMRect,
};
@@ -298,7 +307,22 @@ function createLintTooltip(
if (block) {
if (block !== current) {
anchorX = pe.clientX;
- anchorY = pe.clientY;
+ // A textless block has no text line to measure, so `coordsAtPos` hands
+ // back a zero-height rect (`flattenH` in block context): its own top
+ // edge for a plain leaf like a thematic break, but (0,0,0,0) for an
+ // atom node view, whose position DOM is an empty, never-laid-out
+ // element. The second would anchor the callout to the viewport origin
+ // instead of to the block, so a collapsed measurement falls back to the
+ // block's own box — the wider clearance, which is also what the
+ // declared `| null` arm takes. That arm is unreachable from here by
+ // construction (a lint block is a child of `view.dom`, and the null
+ // arms require coords outside it).
+ const found = view.posAtCoords({ left: pe.clientX, top: pe.clientY });
+ const measured = found ? view.coordsAtPos(found.pos) : null;
+ const line =
+ measured && measured.bottom > measured.top ? measured : block.getBoundingClientRect();
+ anchorTop = line.top;
+ anchorBottom = line.bottom;
show(block);
} else {
// Still over the same block — keep it alive (cancel any pending hide).
@@ -329,10 +353,31 @@ function createLintTooltip(
if (related !== current && !related?.closest(`.${OK_LINT_BLOCK_CLASS}`)) scheduleHide();
}
+ // Once the user is driving with the keyboard, an overlay raised by a pointer
+ // they are no longer moving is an obstruction, so EVERY key retires it —
+ // deliberately no key allowlist and no `overTooltip` grace. Any exclusion is a
+ // hole (IME `229`, chorded shortcuts, a modifier held before a click), and the
+ // cost of over-firing is one hover the user restores by moving off the block
+ // and back — `pointerover` fires on boundary crossings, not on motion, so a
+ // nudge in place does not re-raise it — while the cost of under-firing is a
+ // box parked on the caret.
+ // Clearing `overTooltip` alongside the hide mirrors what the Fix click does,
+ // for the same reason: a hidden tooltip stops being hit-testable, so the
+ // `pointerleave` that would normally clear the grace flag may never arrive,
+ // and a stale flag makes the next `scheduleHide` return early. Defensive
+ // rather than load-bearing on a spec-compliant engine — the boundary
+ // algorithm dispatches `pointerleave` on the tooltip before any `pointerover`
+ // that could re-raise it, so the stranded window is real but unreachable.
+ function onKeyDown() {
+ overTooltip = false;
+ reallyHide();
+ }
+
tooltip.addEventListener('pointerenter', onTooltipEnter);
tooltip.addEventListener('pointerleave', onTooltipLeave);
view.dom.addEventListener('pointerover', onOver);
view.dom.addEventListener('pointerout', onOut);
+ view.dom.addEventListener('keydown', onKeyDown);
return {
destroy() {
@@ -340,6 +385,7 @@ function createLintTooltip(
stopAutoUpdate?.();
view.dom.removeEventListener('pointerover', onOver);
view.dom.removeEventListener('pointerout', onOut);
+ view.dom.removeEventListener('keydown', onKeyDown);
tooltip.remove();
},
};
diff --git a/packages/app/src/globals.css b/packages/app/src/globals.css
index c34342c73..c7270ad9a 100644
--- a/packages/app/src/globals.css
+++ b/packages/app/src/globals.css
@@ -5635,7 +5635,10 @@ html.electron-mode [data-slot="sidebar-inner"] {
}
/* Hover tooltip for a decorated lint block (markdown-lint-decorations.ts). A
styled, instant alternative to the native `title` — OK popover tokens,
- one diagnostic per line, never intercepts pointer events. */
+ one diagnostic per line. It DOES take pointer events: the Fix button has to
+ be clickable and the enter/leave handlers keep the box alive while the
+ pointer travels to it, so it also swallows clicks on the region it covers
+ (the line above the hovered one). Any keypress retires it. */
.ok-lint-tooltip {
position: absolute;
z-index: 50;
diff --git a/packages/app/tests/stress/markdown-lint.e2e.ts b/packages/app/tests/stress/markdown-lint.e2e.ts
index 49d3dfc11..3c4406a47 100644
--- a/packages/app/tests/stress/markdown-lint.e2e.ts
+++ b/packages/app/tests/stress/markdown-lint.e2e.ts
@@ -12,6 +12,11 @@
* decorations, S9 Problems-panel badge+list+nav composition, plus the live
* re-lint observer path and the no-false-positive negative case.
*
+ * The WYSIWYG hover callout's geometry and dismissal live here for the same
+ * reason: the assertion is real-pixel rect arithmetic between the callout and
+ * the caret's line box, and a layout-less DOM reports both as zero-size rects,
+ * so the jsdom tier would report "no overlap" whatever the code does.
+ *
* markdownlint is opt-in (off by default), so `beforeEach` enables the plugin
* for the worker's project (`.ok/config.yml`); a hard tab then trips MD010.
*
@@ -716,6 +721,298 @@ test.describe('markdown lint — auto-fix', () => {
});
});
+test.describe('markdown lint — WYSIWYG hover callout vs the editing region', () => {
+ // Long enough to wrap, so a click can land mid-line with the pointer left
+ // resting inside the block. The trailing run trips MD009 (auto-fixable), so
+ // the callout renders with its Fix button — the tallest, worst-case form.
+ const OCCLUDING_BODY =
+ '# Title\n\nA long paragraph that wraps across more than one visual line in the editor, so a click can land at the measured vertical centre of a known line box while the pointer keeps resting on the block. \n';
+
+ /**
+ * Max caret-line overlap treated as "clear". The callout's bottom edge is
+ * pinned relative to the anchor, so a correct anchor (the caret's line box)
+ * leaves a gap and the measure floors at 0; only an anchor that ignores the
+ * line's height reads positive. Observed regression magnitudes are 4.0-4.6 px
+ * on ordinary paragraphs and 18.2 px of a 20 px line on a tall JSX block, so
+ * 1 px absorbs sub-pixel and font-rendering jitter while staying 4x below the
+ * smallest real occlusion.
+ */
+ const CARET_OCCLUSION_TOLERANCE_PX = 1;
+
+ interface EdgeRect {
+ top: number;
+ bottom: number;
+ left: number;
+ right: number;
+ }
+
+ interface CalloutGeometry {
+ tooltip: EdgeRect | null;
+ /** The caret's line box: its vertical extent, spanned to the block's width. */
+ caretLine: EdgeRect | null;
+ /** Height of the callout ∩ caret-line intersection; 0 when disjoint or hidden. */
+ caretOcclusionPx: number;
+ elementAtCaret: string | null;
+ }
+
+ /**
+ * Measure the visible callout against the caret's line box — the region the
+ * user is editing. A collapsed caret rect carries the line's height but no
+ * width, and text keeps flowing into the rest of the line as it is typed, so
+ * the horizontal extent comes from the enclosing block rather than from the
+ * caret's own zero-width x.
+ */
+ function readCalloutGeometry(page: Page): Promise<CalloutGeometry> {
+ return page.evaluate(() => {
+ const toEdges = (r: DOMRect) => ({
+ top: r.top,
+ bottom: r.bottom,
+ left: r.left,
+ right: r.right,
+ });
+ const visible =
+ Array.from(document.querySelectorAll<HTMLElement>('.ok-lint-tooltip')).find(
+ (el) => !el.hidden,
+ ) ?? null;
+ const selection = window.getSelection();
+ let caretLine: EdgeRect | null = null;
+ let elementAtCaret: string | null = null;
+ if (selection && selection.rangeCount > 0) {
+ const range = selection.getRangeAt(0).cloneRange();
+ const rects = range.getClientRects();
+ const caret = rects.length > 0 ? rects[0] : range.getBoundingClientRect();
+ const focus = selection.focusNode;
+ const focusElement = focus instanceof Element ? focus : (focus?.parentElement ?? null);
+ const blockRect =
+ focusElement?.closest('.ProseMirror > *')?.getBoundingClientRect() ?? null;
+ caretLine = {
+ top: caret.top,
+ bottom: caret.bottom,
+ left: blockRect ? blockRect.left : caret.left,
+ right: blockRect ? blockRect.right : caret.right,
+ };
+ elementAtCaret =
+ document.elementFromPoint(caret.left + 1, (caret.top + caret.bottom) / 2)?.className ??
+ null;
+ }
+ const tooltip = visible ? toEdges(visible.getBoundingClientRect()) : null;
+ let caretOcclusionPx = 0;
+ if (tooltip && caretLine) {
+ const horizontalOverlap =
+ Math.min(tooltip.right, caretLine.right) - Math.max(tooltip.left, caretLine.left);
+ const verticalOverlap =
+ Math.min(tooltip.bottom, caretLine.bottom) - Math.max(tooltip.top, caretLine.top);
+ caretOcclusionPx = horizontalOverlap > 0 ? Math.max(0, verticalOverlap) : 0;
+ }
+ return { tooltip, caretLine, caretOcclusionPx, elementAtCaret };
+ });
+ }
+
+ const visibleCallouts = (page: Page) => page.locator('.ok-lint-tooltip:visible');
+
+ async function lintBlockBox(page: Page) {
+ const block = page.locator('.ProseMirror:not(.composer-prosemirror) .ok-lint-block').first();
+ await expect(block).toBeVisible({ timeout: 15_000 });
+ const box = await block.boundingBox();
+ if (!box) throw new Error('lint block has no layout box');
+ return box;
+ }
+
+ test('the hover callout clears the line box the caret sits in', async ({ page, api }) => {
+ await seed(api, testDocName, OCCLUDING_BODY);
+ const box = await lintBlockBox(page);
+
+ // Click near the top of the block: places the caret AND drags the pointer
+ // into the block, raising the callout. A visible callout here is the
+ // positive precondition — without it the occlusion measurement below would
+ // read 0 vacuously.
+ await page.mouse.click(box.x + 80, box.y + 6);
+ await expect(visibleCallouts(page)).not.toHaveCount(0);
+ const probe = await readCalloutGeometry(page);
+ expect(probe.caretLine, 'no caret after clicking into the lint block').not.toBeNull();
+ const lineBox = probe.caretLine as EdgeRect;
+ // A zero-size line box would make any overlap arithmetic pass trivially —
+ // exactly the vacuous shape a layout-less DOM produces.
+ expect(lineBox.bottom - lineBox.top).toBeGreaterThan(8);
+ expect(lineBox.right - lineBox.left).toBeGreaterThan(50);
+
+ // Leave the block so the next entry re-runs the show path with a fresh
+ // anchor, then click at the measured vertical centre of that same line —
+ // where a user aiming at text in the middle of a line actually clicks.
+ await page.mouse.move(box.x + 20, 60);
+ await expect(visibleCallouts(page)).toHaveCount(0);
+ await page.mouse.click(box.x + 150, (lineBox.top + lineBox.bottom) / 2);
+ await expect(visibleCallouts(page)).not.toHaveCount(0);
+ // floating-ui resolves the placement asynchronously; before it lands the
+ // callout still sits at its initial 0,0, which would also read as no overlap.
+ // Testing both axes rather than a positive `top` keeps the guard honest: a
+ // legitimately-resolved placement can carry a non-positive top near the
+ // viewport edge, which a `top > 0` poll would misread as never-positioned.
+ await expect
+ .poll(
+ async () => {
+ const { tooltip } = await readCalloutGeometry(page);
+ return tooltip ? tooltip.top !== 0 || tooltip.left !== 0 : false;
+ },
+ {
+ message: 'the hover callout never received a computed position',
+ },
+ )
+ .toBe(true);
+
+ const geometry = await readCalloutGeometry(page);
+ // Stated locally rather than leaned on: a hidden callout makes the
+ // occlusion measure below read 0 and pass for the wrong reason.
+ expect(geometry.tooltip, 'the hover callout vanished before it was measured').not.toBeNull();
+ expect(
+ geometry.caretLine && Math.abs(geometry.caretLine.top - lineBox.top),
+ 'the second click landed on a different line than the one that was measured',
+ ).toBeLessThan(2);
+ expect(
+ geometry.caretOcclusionPx,
+ `hover callout overlaps the caret line box by ${geometry.caretOcclusionPx.toFixed(2)}px — ` +
+ `callout=${JSON.stringify(geometry.tooltip)} caretLine=${JSON.stringify(geometry.caretLine)} ` +
+ `topmostElementAtCaret=${geometry.elementAtCaret}`,
+ ).toBeLessThanOrEqual(CARET_OCCLUSION_TOLERANCE_PX);
+ });
+
+ test('typing with the pointer resting on the block retires the hover callout', async ({
+ page,
+ api,
+ }) => {
+ await seed(api, testDocName, OCCLUDING_BODY);
+ const box = await lintBlockBox(page);
+
+ await page.mouse.click(box.x + 80, box.y + box.height / 2);
+ await expect(visibleCallouts(page)).not.toHaveCount(0);
+
+ // The pointer never moves again — the only thing that can retire the
+ // callout is the typing itself.
+ await page.keyboard.type('typing under the callout', { delay: 25 });
+ await expect(visibleCallouts(page)).toHaveCount(0);
+ });
+
+ test('arrow-key caret movement retires the hover callout', async ({ page, api }) => {
+ await seed(api, testDocName, OCCLUDING_BODY);
+ const box = await lintBlockBox(page);
+
+ await page.mouse.click(box.x + 80, box.y + 6);
+ await expect(visibleCallouts(page)).not.toHaveCount(0);
+
+ // Keyboard navigation moves the caret out from under the point the callout
+ // was anchored against, so a callout still parked there sits over text the
+ // user is now editing. Separate from the typing case: a dismissal wired to
+ // document changes alone would leave this one covered.
+ await page.keyboard.press('ArrowDown');
+ await page.keyboard.press('ArrowDown');
+ await expect(visibleCallouts(page)).toHaveCount(0);
+ });
+
+ test('the hover callout comes back when the pointer moves after a keyboard dismissal', async ({
+ page,
+ api,
+ }) => {
+ await seed(api, testDocName, OCCLUDING_BODY);
+ const box = await lintBlockBox(page);
+
+ await page.mouse.click(box.x + 80, box.y + 6);
+ await expect(visibleCallouts(page)).not.toHaveCount(0);
+
+ // Caret-only navigation rather than typing: it retires the callout without
+ // editing the document, so the block stays decorated and there is still a
+ // callout to raise again. (Typing here would rewrite the trailing run that
+ // produces the diagnostic in the first place.)
+ await page.keyboard.press('ArrowRight');
+ await expect(visibleCallouts(page)).toHaveCount(0);
+
+ // Off the block and back on. `pointerover` fires on boundary crossings, not
+ // on motion: two 4 px moves inside one block were measured to produce zero
+ // events, so a nudge in place would leave this assertion passing on an
+ // accident of hit-testing rather than on the re-arm actually working.
+ await page.mouse.move(box.x + 20, 60);
+ await page.mouse.move(box.x + 140, box.y + 6);
+ // Hover-to-read must survive the dismissal: a callout that never returns
+ // has traded the reported bug for the loss of the whole affordance. The
+ // diagnostic text proves this is the real callout re-shown, not a stray
+ // empty box left standing.
+ await expect(visibleCallouts(page)).not.toHaveCount(0);
+ await expect(visibleCallouts(page).first()).toContainText('MD009');
+ });
+
+ // A 100x100 PNG, inline so the image resolves without a network fetch: a fake
+ // src renders the not-found placeholder AND trips the console-error gate.
+ const INLINE_PNG =
+ 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAAJ0lEQVR4nO3BMQEAAADCoPVPbQhfoAAAAAAAAAAAAAAAAAAAAOBrAB+wAAF7bJcRAAAAAElFTkSuQmCC';
+ // Both textless shapes that get decorated, in one doc: the alt-less image
+ // (MD045) and the second, differently-styled thematic break (MD035).
+ const TEXTLESS_BODY = `# Title\n\nA paragraph of ordinary text.\n\n![](${INLINE_PNG})\n\nMore ordinary text.\n\n---\n\nEven more text.\n\n***\n\nEnd.\n`;
+
+ /**
+ * Max distance from the callout's bottom edge to the top of the block it
+ * describes. `offset(6)` sets the intended gap; the allowance absorbs
+ * `shift()` nudges and sub-pixel jitter while staying far below a callout
+ * that has lost its anchor altogether — an anchor rect of all zeros parks it
+ * at the viewport origin, measured 170.4 px from its block on this fixture
+ * and further still on a scrolled document.
+ */
+ const MAX_ANCHOR_GAP_PX = 24;
+
+ test('the hover callout on a textless block anchors to that block', async ({ page, api }) => {
+ // A textless block has no text line for `coordsAtPos` to measure, so it
+ // answers with a zero-height rect — the exact shape the line-box anchor
+ // exists to replace. `flattenH` collapses a thematic break to its own top
+ // edge, which still clears; an atom React node view (the image) has no laid
+ // out position DOM at all and measures as (0,0,0,0), which anchors the
+ // callout to the top-left of the window instead of to the block.
+ await seed(api, testDocName, TEXTLESS_BODY);
+ const atoms = page.locator('.ProseMirror:not(.composer-prosemirror) .ok-lint-block-atom');
+ await expect(atoms.first()).toBeVisible({ timeout: 15_000 });
+ const count = await atoms.count();
+ // Without both shapes present the loop below would pass on the easy one.
+ expect(count, 'expected both textless shapes to be decorated').toBeGreaterThanOrEqual(2);
+
+ for (let index = 0; index < count; index += 1) {
+ const atom = atoms.nth(index);
+ const box = await atom.boundingBox();
+ expect(box, `textless lint block ${index} has no layout box`).not.toBeNull();
+ const blockBox = box as NonNullable<typeof box>;
+
+ // Off the block and back on: `pointerover` fires on boundary crossings,
+ // so re-entry is what re-runs the anchor computation.
+ await page.mouse.move(blockBox.x + 20, 60);
+ await expect(visibleCallouts(page)).toHaveCount(0);
+ await page.mouse.move(blockBox.x + blockBox.width * 0.25, blockBox.y + blockBox.height / 2);
+ await expect(visibleCallouts(page)).not.toHaveCount(0);
+ await expect
+ .poll(
+ async () => {
+ const { tooltip } = await readCalloutGeometry(page);
+ return tooltip ? tooltip.top !== 0 || tooltip.left !== 0 : false;
+ },
+ { message: 'the hover callout never received a computed position' },
+ )
+ .toBe(true);
+
+ const { tooltip } = await readCalloutGeometry(page);
+ expect(tooltip, 'the hover callout vanished before it was measured').not.toBeNull();
+ const callout = tooltip as EdgeRect;
+ const gapPx = blockBox.y - callout.bottom;
+ expect(
+ gapPx,
+ `hover callout sits ${gapPx.toFixed(2)}px above the block it describes — ` +
+ `callout=${JSON.stringify(callout)} block=${JSON.stringify(blockBox)}`,
+ ).toBeLessThanOrEqual(MAX_ANCHOR_GAP_PX);
+ // The other side of the same invariant: a callout that has slid down over
+ // the block is anchored no better than one that flew off the top.
+ expect(
+ gapPx,
+ `hover callout overlaps the block it describes by ${(-gapPx).toFixed(2)}px — ` +
+ `callout=${JSON.stringify(callout)} block=${JSON.stringify(blockBox)}`,
+ ).toBeGreaterThanOrEqual(0);
+ }
+ });
+});
+
/** Seed content via agent-write-md (replace mode). */
async function seed(api: ApiHelpers, docName: string, markdown: string) {
await api.replaceDoc(docName, markdown);
diff --git a/packages/core/src/bridge/bind-frontmatter-doc.ts b/packages/core/src/bridge/bind-frontmatter-doc.ts
index d7a845280..dfd95ef49 100644
--- a/packages/core/src/bridge/bind-frontmatter-doc.ts
+++ b/packages/core/src/bridge/bind-frontmatter-doc.ts
@@ -1,3 +1,4 @@
+
import type * as Y from 'yjs';
import type { Err, Ok, Result } from '../config/result.ts';
import { type FrontmatterValidationError, toFrontmatterIssue } from '../frontmatter/errors.ts';
diff --git a/packages/core/src/bridge/bridge-invariant.ts b/packages/core/src/bridge/bridge-invariant.ts
index 005627195..8bfdb40cd 100644
--- a/packages/core/src/bridge/bridge-invariant.ts
+++ b/packages/core/src/bridge/bridge-invariant.ts
@@ -1,3 +1,4 @@
+
import { fnv1aDigest } from './hash-util.ts';
export type BridgeInvariantSite = 'observer-b' | 'persistence' | 'test-harness';
diff --git a/packages/core/src/bridge/compose.ts b/packages/core/src/bridge/compose.ts
index f4cc8a286..2a597ec3d 100644
--- a/packages/core/src/bridge/compose.ts
+++ b/packages/core/src/bridge/compose.ts
@@ -1,3 +1,4 @@
+
import { prependFrontmatter, stripFrontmatter } from '../extensions/frontmatter.ts';
export type ComposeAdjustment = 'none' | 'body' | 'frontmatter' | 'unresolved';
diff --git a/packages/core/src/bridge/divergence-locate.ts b/packages/core/src/bridge/divergence-locate.ts
index 6b505314d..d979f4b39 100644
--- a/packages/core/src/bridge/divergence-locate.ts
+++ b/packages/core/src/bridge/divergence-locate.ts
@@ -1,3 +1,4 @@
+
import { findFirstDivergenceIndex } from './tolerance-telemetry.ts';
export const BRIDGE_LINE_KINDS = [
diff --git a/packages/core/src/bridge/doc-boundary-space.ts b/packages/core/src/bridge/doc-boundary-space.ts
index 8fb428b90..01ef76a9f 100644
--- a/packages/core/src/bridge/doc-boundary-space.ts
+++ b/packages/core/src/bridge/doc-boundary-space.ts
@@ -1,3 +1,4 @@
+
import { FRONTMATTER_RE, stripFrontmatter } from '../extensions/frontmatter.ts';
import { carriedEdgeEmpties, type DocEdgeEmpties } from '../markdown/doc-edge-blank-runs.ts';
diff --git a/packages/core/src/bridge/growth-detect.ts b/packages/core/src/bridge/growth-detect.ts
index 9d9c244b0..463e89595 100644
--- a/packages/core/src/bridge/growth-detect.ts
+++ b/packages/core/src/bridge/growth-detect.ts
@@ -1,3 +1,4 @@
+
const DEFAULT_MIN_SUBSTANTIVE_LINE_LENGTH = 16;
export const DUPLICATION_GATE_MIN_LINE_LENGTH = 8;
diff --git a/packages/core/src/bridge/intraline-predicate.ts b/packages/core/src/bridge/intraline-predicate.ts
index c43fdd7e7..0939885bb 100644
--- a/packages/core/src/bridge/intraline-predicate.ts
+++ b/packages/core/src/bridge/intraline-predicate.ts
@@ -1,3 +1,4 @@
+
export function rawLineCounts(doc: string): Map<string, number> {
const counts = new Map<string, number>();
for (const line of doc.split('\n')) {
diff --git a/packages/core/src/bridge/merge-three-way.ts b/packages/core/src/bridge/merge-three-way.ts
index 251560a35..c0dc65705 100644
--- a/packages/core/src/bridge/merge-three-way.ts
+++ b/packages/core/src/bridge/merge-three-way.ts
@@ -65,6 +65,7 @@ export function tryLineLevelCombine(
return { clean: true, merged };
}
+
export type BridgeMergeContentLossSide = 'user' | 'agent';
export type BridgeMergeContentLossWhich = 'substring' | 'order' | 'growth';
diff --git a/packages/core/src/bridge/normalize.ts b/packages/core/src/bridge/normalize.ts
index 01ac80099..dcc5b0690 100644
--- a/packages/core/src/bridge/normalize.ts
+++ b/packages/core/src/bridge/normalize.ts
@@ -1,3 +1,4 @@
+
import { stripFrontmatter } from '../extensions/frontmatter.ts';
import { bodyEdgeEmpties } from './doc-boundary-space.ts';
diff --git a/packages/core/src/bridge/pm-structural-equivalence.ts b/packages/core/src/bridge/pm-structural-equivalence.ts
index 754dc5cc2..0be5203e4 100644
--- a/packages/core/src/bridge/pm-structural-equivalence.ts
+++ b/packages/core/src/bridge/pm-structural-equivalence.ts
@@ -32,6 +32,7 @@ const BR_SENTINEL: PmStructuralNode = { type: '__br__' };
const BR_LITERAL_RE = /^<br\s*\/?>$/i;
+
interface DegradeEntry {
readonly label: string;
readonly severity: ToleranceClassSeverity;
@@ -127,6 +128,7 @@ export interface ComparePmStructuralOptions {
ignoreAttrs?: (attrKey: string) => boolean;
}
+
/** Rebuild a node with `fn` applied to each child; identity when childless.
* Shared by the degrade canonicalizers so none re-implements the walk. */
function mapChildren(
@@ -248,6 +250,7 @@ function applyDegrades(tree: PmStructuralNode): {
return { normalized: current, fired };
}
+
export function comparePmStructural(
expected: PmStructuralNode,
actual: PmStructuralNode,
diff --git a/packages/core/src/bridge/subsequence.ts b/packages/core/src/bridge/subsequence.ts
index af20de1e2..dca644141 100644
--- a/packages/core/src/bridge/subsequence.ts
+++ b/packages/core/src/bridge/subsequence.ts
@@ -1,3 +1,4 @@
+
/** True when `needle` is a subsequence of `haystack` (two-pointer, O(n+m)):
* insertions in `haystack` are free; any dropped or substituted `needle` byte
* fails. */
diff --git a/packages/core/src/markdown/callout-transformer.ts b/packages/core/src/markdown/callout-transformer.ts
index 83d47404a..a363dfd54 100644
--- a/packages/core/src/markdown/callout-transformer.ts
+++ b/packages/core/src/markdown/callout-transformer.ts
@@ -1,3 +1,4 @@
+
import type { Blockquote, Paragraph, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/code-fence.ts b/packages/core/src/markdown/code-fence.ts
index 9807a7e82..4499dbc92 100644
--- a/packages/core/src/markdown/code-fence.ts
+++ b/packages/core/src/markdown/code-fence.ts
@@ -1,3 +1,4 @@
+
export function selectFenceChar(info: string): '`' | '~' {
return info.includes('`') ? '~' : '`';
}
diff --git a/packages/core/src/markdown/comment-promoter.ts b/packages/core/src/markdown/comment-promoter.ts
index 7415c474a..34704165b 100644
--- a/packages/core/src/markdown/comment-promoter.ts
+++ b/packages/core/src/markdown/comment-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Paragraph, PhrasingContent, Root, RootContent, Text } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/dedent-block-jsx-close.ts b/packages/core/src/markdown/dedent-block-jsx-close.ts
index ece5c02a1..b6299a948 100644
--- a/packages/core/src/markdown/dedent-block-jsx-close.ts
+++ b/packages/core/src/markdown/dedent-block-jsx-close.ts
@@ -1,3 +1,4 @@
+
import { findFencedRegions, isInsideFence } from './fence-regions.ts';
const INDENTED_BLOCK_JSX_CLOSE_RE = /^([ ]{1,3})(<\/[A-Z][A-Za-z0-9_]*\s*>)([ \t]*)$/gm;
diff --git a/packages/core/src/markdown/details-accordion-promoter.ts b/packages/core/src/markdown/details-accordion-promoter.ts
index 54774764a..acd398aa6 100644
--- a/packages/core/src/markdown/details-accordion-promoter.ts
+++ b/packages/core/src/markdown/details-accordion-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Paragraph, Parent, Root, Text } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/div-align-promoter.ts b/packages/core/src/markdown/div-align-promoter.ts
index 43ecdc709..ba9b56384 100644
--- a/packages/core/src/markdown/div-align-promoter.ts
+++ b/packages/core/src/markdown/div-align-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Paragraph, Parent, Root, Text } from 'mdast';
import type { MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/fence-regions.ts b/packages/core/src/markdown/fence-regions.ts
index 6d3f3643e..4513da9bb 100644
--- a/packages/core/src/markdown/fence-regions.ts
+++ b/packages/core/src/markdown/fence-regions.ts
@@ -1,3 +1,4 @@
+
const FENCE_RE = /^(`{3,}|~{3,})/gm;
export function findFencedRegions(src: string): Array<[number, number]> {
diff --git a/packages/core/src/markdown/fixtures/index.ts b/packages/core/src/markdown/fixtures/index.ts
index 00f5771ee..6931623c7 100644
--- a/packages/core/src/markdown/fixtures/index.ts
+++ b/packages/core/src/markdown/fixtures/index.ts
@@ -1,3 +1,4 @@
+
import { readFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -8,6 +9,7 @@ function fixturePath(...segments: string[]): string {
return resolve(FIXTURES_DIR, ...segments);
}
+
interface GfmExample {
section: string;
markdown: string;
@@ -17,6 +19,7 @@ export function loadGfmExamples(): GfmExample[] {
return JSON.parse(readFileSync(fixturePath('gfm', 'examples.json'), 'utf8')) as GfmExample[];
}
+
interface MdxCrashEntry {
id: string;
input: string;
@@ -68,6 +71,7 @@ export function loadLargeEmbedFixtures(): LargeEmbedFixture[] {
) as LargeEmbedFixture[];
}
+
export function loadPrd6955Before(): string {
return readFileSync(fixturePath('regression', 'prd-6955-before.md'), 'utf8');
}
@@ -76,6 +80,7 @@ export function loadPrd6955CorruptedTriplicated(): string {
return readFileSync(fixturePath('regression', 'prd-6955-corrupted-triplicated.md'), 'utf8');
}
+
export interface NgPinnedCase {
id: string;
name: string;
@@ -92,6 +97,7 @@ export function loadNgPinnedCases(): NgPinnedCase[] {
) as NgPinnedCase[];
}
+
export function loadLargeRealistic(): string {
return readFileSync(fixturePath('perf', 'large-realistic.md'), 'utf8');
}
diff --git a/packages/core/src/markdown/fixtures/perf/generate.ts b/packages/core/src/markdown/fixtures/perf/generate.ts
index 8b1eb8519..daa3ef82b 100644
--- a/packages/core/src/markdown/fixtures/perf/generate.ts
+++ b/packages/core/src/markdown/fixtures/perf/generate.ts
@@ -1,3 +1,4 @@
+
import { writeFileSync } from 'node:fs';
import { dirname, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
@@ -10,6 +11,7 @@ const BASELINE_ONLY_COUNTS = [500, 2500] as const;
const SEED = 0xf1de1117;
+
function mulberry32(seed: number): () => number {
let a = seed >>> 0;
return () => {
@@ -36,6 +38,7 @@ function pickWeighted<T>(rand: () => number, items: readonly [T, number][]): T {
return items[items.length - 1][0];
}
+
const WORDS = [
'lorem',
'ipsum',
@@ -153,6 +156,7 @@ function mdxBlock(rand: () => number): string {
return `<${name}>\n\n${sentence(rand)}\n\n</${name}>`;
}
+
type BlockKind = 'paragraph' | 'heading' | 'list' | 'code' | 'table' | 'mdx';
const MIX: readonly [BlockKind, number][] = [
@@ -191,6 +195,7 @@ function generateDocument(blockCount: number, seed: number): string {
return `${blocks.join('\n\n')}\n`;
}
+
function main(): void {
for (const count of [...BLOCK_COUNTS, ...BASELINE_ONLY_COUNTS]) {
const doc = generateDocument(count, SEED);
diff --git a/packages/core/src/markdown/guard-flanking-matrix.ts b/packages/core/src/markdown/guard-flanking-matrix.ts
index 420dc0fe5..32c055c5b 100644
--- a/packages/core/src/markdown/guard-flanking-matrix.ts
+++ b/packages/core/src/markdown/guard-flanking-matrix.ts
@@ -7,6 +7,7 @@ import {
import { BACKSLASH_GUARD_SUBSTITUTIONS, encodeBackslashEscapes } from './backslash-escape-guard.ts';
import { ENTITY_REF_GUARD_SUBSTITUTIONS, encodeEntityRefs } from './entity-ref-guard.ts';
+
export const ATTENTION_DELIMITERS = ['*', '_', '**', '~~', '=='] as const;
export type FlankClass = 'whitespace' | 'punctuation' | 'other';
diff --git a/packages/core/src/markdown/handler-shadow-audit.ts b/packages/core/src/markdown/handler-shadow-audit.ts
index 2653473da..283913255 100644
--- a/packages/core/src/markdown/handler-shadow-audit.ts
+++ b/packages/core/src/markdown/handler-shadow-audit.ts
@@ -1,3 +1,4 @@
+
export interface HandlerShadowWitness {
input: string;
expect: 'byte' | 'byte-and-reparse-type';
diff --git a/packages/core/src/markdown/highlight-promoter.ts b/packages/core/src/markdown/highlight-promoter.ts
index da0a81d23..5d1000cc4 100644
--- a/packages/core/src/markdown/highlight-promoter.ts
+++ b/packages/core/src/markdown/highlight-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Parent, PhrasingContent, Root, Text } from 'mdast';
import type { MdxJsxTextElement } from 'mdast-util-mdx';
import { SKIP, visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/html-to-mdast.ts b/packages/core/src/markdown/html-to-mdast.ts
index 787315157..9681c0056 100644
--- a/packages/core/src/markdown/html-to-mdast.ts
+++ b/packages/core/src/markdown/html-to-mdast.ts
@@ -1,3 +1,4 @@
+
import type { Element as HastElement, Root as HastRoot } from 'hast';
import type { List, Nodes as MdastNodes, Root as MdastRoot } from 'mdast';
import rehypeParse from 'rehype-parse';
@@ -128,7 +129,8 @@ export function htmlToMdast(html: string, options?: HtmlToMdastOptions): MdastRo
throw new HtmlPayloadTooLargeError(html.length, maxBytes);
}
- const processor = unified().use(rehypeParse, { fragment: true });
+ const processor = unified()
+ .use(rehypeParse, { fragment: true });
for (const plugin of cleanupPlugins) {
processor.use(plugin);
diff --git a/packages/core/src/markdown/image-promoter.ts b/packages/core/src/markdown/image-promoter.ts
index 706fa9afb..994eb6917 100644
--- a/packages/core/src/markdown/image-promoter.ts
+++ b/packages/core/src/markdown/image-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Image, Paragraph, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/index.ts b/packages/core/src/markdown/index.ts
index 779e27500..ec1ac1b7e 100644
--- a/packages/core/src/markdown/index.ts
+++ b/packages/core/src/markdown/index.ts
@@ -1,3 +1,4 @@
+
import {
type FromProseMirrorOptions,
fromPmMark,
@@ -206,6 +207,7 @@ export class MarkdownManager {
}
}
+
const registry = createRegistry();
function destructureAttrs(
@@ -254,6 +256,7 @@ function destructureAttrs(
return result;
}
+
function hasDirtyDescendant(node: PmNode): boolean {
let found = false;
node.descendants((child) => {
@@ -276,6 +279,7 @@ function effectiveDirty(node: PmNode, freshnessChecker?: StructuralFreshnessChec
return freshnessChecker ? freshnessChecker.isDiverged(node.toJSON()) : false;
}
+
function isEmptyMdastParagraph(node: MdastNodes): boolean {
if (node.type !== 'paragraph') return false;
const children = node.children ?? [];
@@ -344,6 +348,7 @@ function extractTextFromMdastNodes(nodes: MdastNodes[]): string {
return out;
}
+
import {
AUDIO_EXTENSIONS,
FILE_ATTACHMENT_EXTENSIONS,
@@ -596,6 +601,7 @@ function buildMdastToPmHandlers(
}));
}
+
if (m.emphasis) {
handlers.emphasis = toPmMark(m.emphasis, (node: Emphasis) => ({
sourceDelimiter: node.data?.sourceDelimiter ?? '*',
@@ -676,6 +682,7 @@ function buildMdastToPmHandlers(
}));
}
+
if (m.link) {
const sourceLiteralMark = m.sourceLiteral;
handlers.link = (node: Link, _parent: MdastParent, state: MdastToPmState) => {
@@ -973,6 +980,7 @@ function buildMdastToPmHandlers(
};
}
+
const blockUnknownHandler = (node: {
type: string;
position?: { start: { offset: number }; end: { offset: number } };
@@ -1098,6 +1106,7 @@ function buildMdastToPmHandlers(
return handlers as RemarkProseMirrorOptions['handlers'];
}
+
function buildPmToMdastHandlers(
schema: Schema,
freshness: FreshnessCheckerHolder,
diff --git a/packages/core/src/markdown/lint/applies-to.ts b/packages/core/src/markdown/lint/applies-to.ts
index fa0be9e86..b79e9aef7 100644
--- a/packages/core/src/markdown/lint/applies-to.ts
+++ b/packages/core/src/markdown/lint/applies-to.ts
@@ -1,3 +1,4 @@
+
import picomatch from 'picomatch';
import { SUPPORTED_DOC_EXTENSIONS } from '../../constants/doc-extensions.ts';
diff --git a/packages/core/src/markdown/lint/config-files.ts b/packages/core/src/markdown/lint/config-files.ts
index 312c9c74b..94b34dee1 100644
--- a/packages/core/src/markdown/lint/config-files.ts
+++ b/packages/core/src/markdown/lint/config-files.ts
@@ -1,3 +1,4 @@
+
const MARKDOWNLINT_JSON_CONFIG_FILES: ReadonlySet<string> = new Set([
'.markdownlint.json',
'.markdownlint.jsonc',
diff --git a/packages/core/src/markdown/lint/config-schemas.ts b/packages/core/src/markdown/lint/config-schemas.ts
index 3d4814597..7d97004fb 100644
--- a/packages/core/src/markdown/lint/config-schemas.ts
+++ b/packages/core/src/markdown/lint/config-schemas.ts
@@ -51,6 +51,7 @@ const fullPluginShape = Object.fromEntries(
LINT_PLUGINS.map((plugin) => [plugin.id, plugin.sliceSchema]),
) as z.ZodRawShape;
+
export const LinterConfigSchema = z.object({
enabled: z.boolean(),
plugins: z.object(fullPluginShape),
diff --git a/packages/core/src/markdown/lint/default-config.ts b/packages/core/src/markdown/lint/default-config.ts
index d48eea5e4..a51f2ffb0 100644
--- a/packages/core/src/markdown/lint/default-config.ts
+++ b/packages/core/src/markdown/lint/default-config.ts
@@ -6,6 +6,7 @@ export const DEFAULT_MARKDOWNLINT_CONFIG: Record<string, MarkdownlintRuleSetting
MD013: false,
};
+
export function resolveMarkdownlintConfig(
rules: Record<string, MarkdownlintRuleSetting> | undefined,
): Configuration {
diff --git a/packages/core/src/markdown/lint/frontmatter-schema-edit.ts b/packages/core/src/markdown/lint/frontmatter-schema-edit.ts
index ef478e268..9c9542661 100644
--- a/packages/core/src/markdown/lint/frontmatter-schema-edit.ts
+++ b/packages/core/src/markdown/lint/frontmatter-schema-edit.ts
@@ -1,3 +1,4 @@
+
import { CANONICAL_SCHEMA_DIALECT_URIS, DEFAULT_SCHEMA_DIALECT } from './frontmatter-validate.ts';
export interface FrontmatterFieldConstraint {
diff --git a/packages/core/src/markdown/lint/frontmatter-validate.ts b/packages/core/src/markdown/lint/frontmatter-validate.ts
index eba37cee7..ca6eed91c 100644
--- a/packages/core/src/markdown/lint/frontmatter-validate.ts
+++ b/packages/core/src/markdown/lint/frontmatter-validate.ts
@@ -1,3 +1,4 @@
+
import Ajv, { type ValidateFunction } from 'ajv';
import Ajv2019 from 'ajv/dist/2019.js';
import Ajv2020 from 'ajv/dist/2020.js';
diff --git a/packages/core/src/markdown/lint/index.ts b/packages/core/src/markdown/lint/index.ts
index ae5ff2924..9c2a0875e 100644
--- a/packages/core/src/markdown/lint/index.ts
+++ b/packages/core/src/markdown/lint/index.ts
@@ -1,3 +1,4 @@
+
import { LINT_PLUGINS, type LinterConfig } from './plugins.ts';
import type { LintDiagnostic } from './types.ts';
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts b/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts
index 7a5af097e..f438f1b16 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts
@@ -1,3 +1,4 @@
+
import type { OkfRuleId } from '../okf-rule-meta.ts';
import { fileNameFor, OKF_SCHEMA_DIR, okfSchemaPathFor } from './paths.ts';
import { OKF_FRONTMATTER_REGISTRY } from './registry.ts';
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/paths.ts b/packages/core/src/markdown/lint/okf-frontmatter/paths.ts
index 1ee913527..c290b6878 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/paths.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/paths.ts
@@ -1,3 +1,4 @@
+
import type { OkfRuleId } from '../okf-rule-meta.ts';
export const OKF_SCHEMA_DIR = '.ok/okf';
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/registry.ts b/packages/core/src/markdown/lint/okf-frontmatter/registry.ts
index de09740c5..5168602d5 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/registry.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/registry.ts
@@ -1,3 +1,4 @@
+
import { compileAppliesTo } from '../applies-to.ts';
import { validateFrontmatterSource } from '../frontmatter-validate.ts';
import { isOkfRuleEnabled, type OkfRuleId, type OkfRuleToggles } from '../okf-rule-meta.ts';
diff --git a/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts b/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts
index f1c37671b..89845d3d5 100644
--- a/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts
+++ b/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts
@@ -1,3 +1,4 @@
+
// file-level form is deliberate: the sibling `biome-ignore` must sit on the line
// oxlint-disable unicorn/no-thenable
diff --git a/packages/core/src/markdown/lint/okf-project/rules.ts b/packages/core/src/markdown/lint/okf-project/rules.ts
index 6d691ae2b..8b476332e 100644
--- a/packages/core/src/markdown/lint/okf-project/rules.ts
+++ b/packages/core/src/markdown/lint/okf-project/rules.ts
@@ -1,3 +1,4 @@
+
import { SUPPORTED_DOC_EXTENSIONS } from '../../../constants/doc-extensions.ts';
import { isOkfRuleEnabled, type OkfRuleId, type OkfRuleToggles } from '../okf-rule-meta.ts';
diff --git a/packages/core/src/markdown/lint/okf-rule-meta.ts b/packages/core/src/markdown/lint/okf-rule-meta.ts
index 4de50d79f..44913a9dc 100644
--- a/packages/core/src/markdown/lint/okf-rule-meta.ts
+++ b/packages/core/src/markdown/lint/okf-rule-meta.ts
@@ -1,3 +1,4 @@
+
export const OKF_RULE_IDS = [
'no-wiki-links',
'log-shape',
diff --git a/packages/core/src/markdown/lint/okf-rules.ts b/packages/core/src/markdown/lint/okf-rules.ts
index 1d5538421..d0999b62e 100644
--- a/packages/core/src/markdown/lint/okf-rules.ts
+++ b/packages/core/src/markdown/lint/okf-rules.ts
@@ -1,3 +1,4 @@
+
import { isOkfRuleEnabled, type OkfRuleId, type OkfRuleToggles } from './okf-rule-meta.ts';
import type { OkfRule } from './okf-runner.ts';
import { indexShape } from './rules/index-shape.ts';
diff --git a/packages/core/src/markdown/lint/okf-runner.ts b/packages/core/src/markdown/lint/okf-runner.ts
index de130e3f4..fabb08d6e 100644
--- a/packages/core/src/markdown/lint/okf-runner.ts
+++ b/packages/core/src/markdown/lint/okf-runner.ts
@@ -1,3 +1,4 @@
+
import type { Root } from 'mdast';
import remarkFrontmatter from 'remark-frontmatter';
import remarkGfm from 'remark-gfm';
diff --git a/packages/core/src/markdown/lint/plugins.ts b/packages/core/src/markdown/lint/plugins.ts
index 4b9df9c56..03efcf66c 100644
--- a/packages/core/src/markdown/lint/plugins.ts
+++ b/packages/core/src/markdown/lint/plugins.ts
@@ -1,3 +1,4 @@
+
import { z } from 'zod';
import { DEFAULT_MARKDOWNLINT_CONFIG, resolveMarkdownlintConfig } from './default-config.ts';
import {
@@ -17,6 +18,7 @@ import {
type OkfSlice,
} from './types.ts';
+
const MarkdownlintRuleSettingSchema = z.union([
z.boolean(),
z.enum(MARKDOWNLINT_RULE_SEVERITIES),
diff --git a/packages/core/src/markdown/lint/rules/index-shape.ts b/packages/core/src/markdown/lint/rules/index-shape.ts
index 59fe9b87d..fcbb1b56c 100644
--- a/packages/core/src/markdown/lint/rules/index-shape.ts
+++ b/packages/core/src/markdown/lint/rules/index-shape.ts
@@ -1,3 +1,4 @@
+
import type { List, ListItem } from 'mdast';
import { EXIT, visit } from 'unist-util-visit';
import { defineScopedOkfRule } from '../okf-runner.ts';
diff --git a/packages/core/src/markdown/lint/rules/log-shape.ts b/packages/core/src/markdown/lint/rules/log-shape.ts
index e0159519f..431e4e9c8 100644
--- a/packages/core/src/markdown/lint/rules/log-shape.ts
+++ b/packages/core/src/markdown/lint/rules/log-shape.ts
@@ -1,3 +1,4 @@
+
import type { Heading } from 'mdast';
import { toString as headingText } from 'mdast-util-to-string';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/lint/rules/no-wiki-links.ts b/packages/core/src/markdown/lint/rules/no-wiki-links.ts
index 2123e977f..f75a04d15 100644
--- a/packages/core/src/markdown/lint/rules/no-wiki-links.ts
+++ b/packages/core/src/markdown/lint/rules/no-wiki-links.ts
@@ -1,3 +1,4 @@
+
import type { Point } from 'unist';
import { visit } from 'unist-util-visit';
import { defineOkfRule } from '../okf-runner.ts';
diff --git a/packages/core/src/markdown/lint/rules/reserved-casing.ts b/packages/core/src/markdown/lint/rules/reserved-casing.ts
index 89ef3e4a9..c8b4d8f28 100644
--- a/packages/core/src/markdown/lint/rules/reserved-casing.ts
+++ b/packages/core/src/markdown/lint/rules/reserved-casing.ts
@@ -1,3 +1,4 @@
+
import { SUPPORTED_DOC_EXTENSIONS } from '../../../constants/doc-extensions.ts';
import { defineOkfRule } from '../okf-runner.ts';
diff --git a/packages/core/src/markdown/lint/types.ts b/packages/core/src/markdown/lint/types.ts
index 2a8f4a279..4fa9a5a27 100644
--- a/packages/core/src/markdown/lint/types.ts
+++ b/packages/core/src/markdown/lint/types.ts
@@ -1,3 +1,4 @@
+
import type { BrokenLinkReason } from '../../schemas/api/agent-write.ts';
import type { OkfRuleId } from './okf-rule-meta.ts';
@@ -105,6 +106,7 @@ export interface OkfSlice {
generate?: { index?: boolean };
}
+
interface RuleOptionSpecBase {
key: string;
description: string;
diff --git a/packages/core/src/markdown/lint/validation-counts.ts b/packages/core/src/markdown/lint/validation-counts.ts
index 98238656e..437cc539a 100644
--- a/packages/core/src/markdown/lint/validation-counts.ts
+++ b/packages/core/src/markdown/lint/validation-counts.ts
@@ -1,3 +1,4 @@
+
export interface ValidationSourceCounts {
errorCount: number;
warningCount: number;
diff --git a/packages/core/src/markdown/math-promoter.ts b/packages/core/src/markdown/math-promoter.ts
index a5b511f25..bd79424c7 100644
--- a/packages/core/src/markdown/math-promoter.ts
+++ b/packages/core/src/markdown/math-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Code, Root } from 'mdast';
import type { Math as MdastMath } from 'mdast-util-math';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
diff --git a/packages/core/src/markdown/mdast-to-hast-handlers.ts b/packages/core/src/markdown/mdast-to-hast-handlers.ts
index ed89371d0..00fbc0035 100644
--- a/packages/core/src/markdown/mdast-to-hast-handlers.ts
+++ b/packages/core/src/markdown/mdast-to-hast-handlers.ts
@@ -1,3 +1,4 @@
+
import type { Comment, Element, ElementContent, Properties } from 'hast';
import type { FootnoteDefinition, FootnoteReference } from 'mdast';
import type { MdxJsxFlowElement, MdxJsxTextElement } from 'mdast-util-mdx';
diff --git a/packages/core/src/markdown/mdast-to-html.ts b/packages/core/src/markdown/mdast-to-html.ts
index 8ce2b2492..df788a80d 100644
--- a/packages/core/src/markdown/mdast-to-html.ts
+++ b/packages/core/src/markdown/mdast-to-html.ts
@@ -1,3 +1,4 @@
+
import type { Element, Root as HastRoot, Text as HastText } from 'hast';
import type { Root as MdastRoot, Text as MdastText } from 'mdast';
import type { Handler } from 'mdast-util-to-hast';
diff --git a/packages/core/src/markdown/merged-walker.ts b/packages/core/src/markdown/merged-walker.ts
index bfd7e3109..fa3cfcd86 100644
--- a/packages/core/src/markdown/merged-walker.ts
+++ b/packages/core/src/markdown/merged-walker.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Parent, Root } from 'mdast';
import { SKIP, visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/mermaid-promoter.ts b/packages/core/src/markdown/mermaid-promoter.ts
index 1a897fca8..17ed2b829 100644
--- a/packages/core/src/markdown/mermaid-promoter.ts
+++ b/packages/core/src/markdown/mermaid-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Code, Root } from 'mdast';
import type { MdxJsxAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/parse-with-fallback.ts b/packages/core/src/markdown/parse-with-fallback.ts
index d988f4b8b..4aa0490c4 100644
--- a/packages/core/src/markdown/parse-with-fallback.ts
+++ b/packages/core/src/markdown/parse-with-fallback.ts
@@ -168,6 +168,7 @@ export function parseRecursive(
}
}
+
interface VFilePlace {
offset?: number;
start?: { offset?: number };
@@ -186,6 +187,7 @@ function extractErrorOffset(err: unknown): number | undefined {
return undefined;
}
+
interface Region {
start: number;
end: number;
@@ -209,6 +211,7 @@ function nearestBlankLineAfter(src: string, offset: number): number | null {
return null;
}
+
export interface TagEvent {
kind: 'open' | 'close' | 'self-close';
name: string;
@@ -355,6 +358,7 @@ function findFallbackRegion(src: string, errorOffset: number): Region {
return { start: blockStart, end: blockEnd };
}
+
interface SourceBlock {
src: string;
start: number;
@@ -452,6 +456,7 @@ function tryPerBlockFallback(
};
}
+
function wholeDocRawText(source: string): JSONContent {
return {
type: 'doc',
diff --git a/packages/core/src/markdown/parser-drop-closure.ts b/packages/core/src/markdown/parser-drop-closure.ts
index e6ab4fd57..43d420187 100644
--- a/packages/core/src/markdown/parser-drop-closure.ts
+++ b/packages/core/src/markdown/parser-drop-closure.ts
@@ -1,3 +1,4 @@
+
export type DroppedTokenAdjudication =
| {
kind: 'format-dof-axis';
diff --git a/packages/core/src/markdown/pipeline.ts b/packages/core/src/markdown/pipeline.ts
index 0e3224206..55736041c 100644
--- a/packages/core/src/markdown/pipeline.ts
+++ b/packages/core/src/markdown/pipeline.ts
@@ -1,3 +1,4 @@
+
import {
type FromProseMirrorOptions,
fromProseMirror,
diff --git a/packages/core/src/markdown/position-aware-join.ts b/packages/core/src/markdown/position-aware-join.ts
index 91cdf658f..ccf06e94d 100644
--- a/packages/core/src/markdown/position-aware-join.ts
+++ b/packages/core/src/markdown/position-aware-join.ts
@@ -1,3 +1,4 @@
+
import type { Join } from 'mdast-util-to-markdown';
import type { Position } from 'unist';
import { isBlankLineParagraph } from './zero-emission-blocks.ts';
diff --git a/packages/core/src/markdown/position-slice.ts b/packages/core/src/markdown/position-slice.ts
index 0f399d34c..e5b4c9eba 100644
--- a/packages/core/src/markdown/position-slice.ts
+++ b/packages/core/src/markdown/position-slice.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Root } from 'mdast';
import { visit } from 'unist-util-visit';
import type { VFile } from 'vfile';
@@ -476,7 +477,8 @@ export function applyPositionSliceToNode(
const first = source[startOff];
if (first !== '[' && first !== '<' && !node.title) {
node.data.sourceStyle = 'gfm-autolink';
- } else if (first === '[') {
+ }
+ else if (first === '[') {
const slice = source.slice(startOff, endOff);
const closeBracketIdx = slice.lastIndexOf('](');
if (closeBracketIdx !== -1) {
diff --git a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
index db10fa54b..ca225ce9b 100644
--- a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
+++ b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts
@@ -1,3 +1,4 @@
+
import type { Comment, Element, Root, Text } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
index 34068d103..3a2524a9a 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts
@@ -1,3 +1,4 @@
+
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
index 93151d43b..2279a0189 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts
@@ -1,3 +1,4 @@
+
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
index 188f02d83..a0f467c42 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts
@@ -1,3 +1,4 @@
+
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
index 4ba2c3418..4e8542a21 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts
@@ -1,3 +1,4 @@
+
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
index 1a74b1272..a3c96b24a 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts
@@ -1,3 +1,4 @@
+
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
index de35e7b79..e95cf43d6 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts
@@ -1,3 +1,4 @@
+
import type { Comment, Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
index b4be1b2ea..ffdb4d5b5 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts
@@ -1,3 +1,4 @@
+
import type { Element, ElementContent, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
index 3c8d88b7c..e2a96d1a7 100644
--- a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
+++ b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts
@@ -1,3 +1,4 @@
+
import type { Element, Root } from 'hast';
import type { Plugin } from 'unified';
diff --git a/packages/core/src/markdown/resolve-image-url.ts b/packages/core/src/markdown/resolve-image-url.ts
index cf2c9da8e..0389575ac 100644
--- a/packages/core/src/markdown/resolve-image-url.ts
+++ b/packages/core/src/markdown/resolve-image-url.ts
@@ -1,3 +1,4 @@
+
import { isRelativeUrl } from './safe-url.ts';
function isDevDiagnosticContext(): boolean {
diff --git a/packages/core/src/markdown/safe-url.ts b/packages/core/src/markdown/safe-url.ts
index 4d3250d3a..8be632ba4 100644
--- a/packages/core/src/markdown/safe-url.ts
+++ b/packages/core/src/markdown/safe-url.ts
@@ -1,3 +1,4 @@
+
export const SAFE_URL_SCHEMES = ['https', 'http', 'mailto', 'tel', 'ftp', 'sms'] as const;
const SCHEME_ALT = SAFE_URL_SCHEMES.map((s) => `${s}:`).join('|');
diff --git a/packages/core/src/markdown/serialize-fidelity.test-helper.ts b/packages/core/src/markdown/serialize-fidelity.test-helper.ts
index 0dd54070e..96304e7a5 100644
--- a/packages/core/src/markdown/serialize-fidelity.test-helper.ts
+++ b/packages/core/src/markdown/serialize-fidelity.test-helper.ts
@@ -1,3 +1,4 @@
+
import type { JSONContent } from '@tiptap/core';
import type { Nodes } from 'mdast';
import { expect } from 'vitest';
diff --git a/packages/core/src/markdown/serialize-helpers.ts b/packages/core/src/markdown/serialize-helpers.ts
index 7cac5b042..93798cf83 100644
--- a/packages/core/src/markdown/serialize-helpers.ts
+++ b/packages/core/src/markdown/serialize-helpers.ts
@@ -1,3 +1,4 @@
+
import type { Node as PmNode } from '@tiptap/pm/model';
import type {
MdxJsxAttribute,
diff --git a/packages/core/src/markdown/single-dollar-math-promoter.ts b/packages/core/src/markdown/single-dollar-math-promoter.ts
index b012a5aff..8c08b7a04 100644
--- a/packages/core/src/markdown/single-dollar-math-promoter.ts
+++ b/packages/core/src/markdown/single-dollar-math-promoter.ts
@@ -1,3 +1,4 @@
+
import type { PhrasingContent, Root, Text } from 'mdast';
import type { InlineMath } from 'mdast-util-math';
import { SKIP, visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/to-markdown-handlers.ts b/packages/core/src/markdown/to-markdown-handlers.ts
index 3e79f8cb6..959cc0bd2 100644
--- a/packages/core/src/markdown/to-markdown-handlers.ts
+++ b/packages/core/src/markdown/to-markdown-handlers.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Parents } from 'mdast';
import type { MdxJsxAttribute, MdxJsxExpressionAttribute, MdxJsxFlowElement } from 'mdast-util-mdx';
import type { Handle, Info, State } from 'mdast-util-to-markdown';
diff --git a/packages/core/src/markdown/underline-promoter.ts b/packages/core/src/markdown/underline-promoter.ts
index 0f1b0f27d..6e6d73400 100644
--- a/packages/core/src/markdown/underline-promoter.ts
+++ b/packages/core/src/markdown/underline-promoter.ts
@@ -1,3 +1,4 @@
+
import type { Nodes, Parent, Root } from 'mdast';
import type { MdxJsxTextElement } from 'mdast-util-mdx';
import { visit } from 'unist-util-visit';
diff --git a/packages/core/src/markdown/unknown-mdast-guard.ts b/packages/core/src/markdown/unknown-mdast-guard.ts
index 1a082bda7..932d7d2a8 100644
--- a/packages/core/src/markdown/unknown-mdast-guard.ts
+++ b/packages/core/src/markdown/unknown-mdast-guard.ts
@@ -1,3 +1,4 @@
+
import type { Root as MdastRoot } from 'mdast';
import type { VFile } from 'vfile';
diff --git a/packages/core/src/markdown/whitespace-char-ref.ts b/packages/core/src/markdown/whitespace-char-ref.ts
index d578476a7..ac9f5239b 100644
--- a/packages/core/src/markdown/whitespace-char-ref.ts
+++ b/packages/core/src/markdown/whitespace-char-ref.ts
@@ -1,3 +1,4 @@
+
const INLINE_WHITESPACE_BY_CODE: ReadonlyMap<number, string> = new Map([
[0x20, ' '],
[0x09, '\t'],
diff --git a/packages/core/src/markdown/wiki-link-micromark.ts b/packages/core/src/markdown/wiki-link-micromark.ts
index 6dad26200..afd9936fe 100644
--- a/packages/core/src/markdown/wiki-link-micromark.ts
+++ b/packages/core/src/markdown/wiki-link-micromark.ts
@@ -17,6 +17,7 @@ declare module 'micromark-util-types' {
}
}
+
const CODE_BANG = 33; // !
const CODE_LBRACKET = 91; // [
const CODE_RBRACKET = 93; // ]
@@ -260,6 +261,7 @@ export function wikiLinkSyntax(): Extension {
};
}
+
function enterWikiLink(this: CompileContext, token: Token) {
this.enter(
{
@@ -385,6 +387,7 @@ export const wikiLinkToMarkdown: {
unsafe: [{ character: '[', inConstruct: ['phrasing'] }],
};
+
const MICROMARK_EXT = wikiLinkSyntax();
export function remarkWikiLink(this: Processor) {