Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
fix(ok): make task-list checkboxes reachable by typing (PRD-7488) (#3992)
saraha98e7b966fa3
diff --git a/.changeset/task-list-typing-shorthand.md b/.changeset/task-list-typing-shorthand.mdnew file mode 100644index 000000000..bffd8700e--- /dev/null+++ b/.changeset/task-list-typing-shorthand.md@@ -0,0 +1,9 @@+---+"@inkeep/open-knowledge": patch+---++Checkboxes now appear when you type them. Start a line with `[] `, `[ ] `, `[x] `, or `[X] ` and it becomes a task item, the shorthand other markdown editors share.++The hyphenated spellings work too. `- [ ] `, `* [x] ` and friends previously left the brackets sitting in the list item as literal text: the `- ` had already turned the line into a bullet by the time you reached the `[`, so the rule that was meant to catch a checkbox no longer had a marker to match against. Between that and the missing bare shorthand, no sequence of keystrokes produced a checkbox at all — only the slash command and Cmd+Shift+9 could.++Empty brackets are a convenience on the way in, not a change to what gets written: every unchecked box saves as `- [ ] `, and only the uppercase `- [X] ` keeps its capital. Backspace right after a box appears on its own line dissolves it back to plain text, the same as it does for a bullet you did not mean to start. After `- [ ] `, where the bullet and the box are two separate autocorrections, Backspace undoes the box and leaves the bullet.diff --git a/knip.config.ts b/knip.config.tsindex 0bd60f15f..49222af47 100644--- a/knip.config.ts+++ b/knip.config.ts@@ -125,9 +125,7 @@ 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/editor-rig.test-helper.ts b/packages/app/src/editor/editor-rig.test-helper.tsindex 9f75c33e6..7313de3c9 100644--- a/packages/app/src/editor/editor-rig.test-helper.ts+++ b/packages/app/src/editor/editor-rig.test-helper.ts@@ -16,6 +16,7 @@ import Collaboration from '@tiptap/extension-collaboration';import StarterKit from '@tiptap/starter-kit';import { yUndoPluginKey } from '@tiptap/y-tiptap';import type * as Y from 'yjs';+import { sharedExtensions } from './extensions/shared';export function mountLightEditor(options: { content?: string; extensions: Extensions }): Editor {const host = document.createElement('div');@@ -31,6 +32,31 @@ export function mountLightEditor(options: { content?: string; extensions: Extens});}+/**+ * An editor over the REAL app roster — `sharedExtensions` exactly as shipped,+ * nothing added, nothing swapped. That fidelity is the point for anything+ * asserting which extension wins a keystroke.+ *+ * NOT interchangeable with `mountLightEditor`, which assembles a minimal+ * link-testing schema from StarterKit. Handing `sharedExtensions` to that one+ * yields a doc with FOUR list nodes (`bulletList`, `orderedList`, `listItem`,+ * `list`) and raises nothing, because StarterKit's list family is disabled+ * only inside `sharedExtensions` itself — so the suite would quietly run+ * against a document model the app never builds.+ *+ * Focus is applied here rather than left to the caller (the departure from the+ * rigs above) because a full-roster editor has plugins gated on+ * `view.hasFocus()`. `editor.view.focus()`, not `commands.focus()`, which+ * defers the real DOM focus into a frame landing after a synchronous body.+ */+export function mountAppEditor(): Editor {+ const host = document.createElement('div');+ document.body.appendChild(host);+ const editor = new Editor({ element: host, extensions: sharedExtensions, editable: true });+ editor.view.focus();+ return editor;+}+/*** A `Collaboration`-bound editor over `ydoc` — real y-sync binding, real* y-undo manager. Collaboration owns history, so StarterKit's own undo/redo isdiff --git a/packages/app/tests/dom/task-list-input-rule.dom.test.tsx b/packages/app/tests/dom/task-list-input-rule.dom.test.tsxnew file mode 100644index 000000000..5254fdb56--- /dev/null+++ b/packages/app/tests/dom/task-list-input-rule.dom.test.tsx@@ -0,0 +1,273 @@+/**+ * Typing a checkbox into existence, at the mounted rung.+ *+ * The rules that make a task item are only meaningful through the keystroke+ * path, and that path is where they had a hole: the bullet rule claims `- ` at+ * the space, so a user typing `- [ ] ` was already inside a `listItem` by the+ * time the `[` landed and the hyphenated task rule — whose regex needs that+ * marker — could never match. Every checkbox spelling typed by hand produced+ * literal text instead, while the schema-level regex tests passed, because a+ * regex cannot see which rule ran first.+ *+ * So this tier is the one that can fail the way a user does: the real app+ * roster, a real mounted editor with focus, and the same `handleTextInput`+ * walk the view performs on text input.+ *+ */++import { cleanup } from '@testing-library/react';+import type { Editor } from '@tiptap/core';+import type { Node as PMNode } from '@tiptap/pm/model';+import type { EditorView } from '@tiptap/pm/view';+import { afterEach, describe, expect, test } from 'vitest';+import { mountAppEditor, pressEditorKey } from '../../src/editor/editor-rig.test-helper';++type TextInputHandler = (view: EditorView, from: number, to: number, text: string) => boolean;++const editors: Editor[] = [];++afterEach(() => {+ // Every mount is torn down here rather than at each call site: the+ // parametrised cases below mount one editor per spelling, and a zombie left+ // in `document.body` would be visible to any later test that reads+ // `document.activeElement` or walks the body's children.+ for (const editor of editors.splice(0)) {+ const host = editor.options.element as HTMLElement;+ editor.destroy();+ host.remove();+ }+ cleanup();+});++/** `mountAppEditor` plus this file's teardown registry. */+function mountEditor(): Editor {+ const editor = mountAppEditor();+ editors.push(editor);+ return editor;+}++/**+ * Feed characters the way the view does on text input: walk every plugin's+ * `handleTextInput` until one claims each one, and insert plainly when none+ * does. One character at a time is the point — a rule that only fires when the+ * whole string arrives at once is exactly the defect being pinned.+ */+function type(editor: Editor, text: string): void {+ for (const character of text) {+ const { from, to } = editor.state.selection;+ const handled =+ editor.view.someProp('handleTextInput', (handler) =>+ (handler as TextInputHandler)(editor.view, from, to, character),+ ) ?? false;+ if (!handled) editor.view.dispatch(editor.state.tr.insertText(character));+ }+}++/**+ * Deliver `text` as ONE `handleTextInput` call, the way an IME commit,+ * dictation, or a text-expansion tool hands over a finished phrase — as+ * opposed to `type`, which sends a character at a time the way a keyboard+ * does. Returns whether a rule claimed it.+ */+function typeChunk(editor: Editor, text: string): boolean {+ const { from, to } = editor.state.selection;+ return (+ editor.view.someProp('handleTextInput', (handler) =>+ (handler as TextInputHandler)(editor.view, from, to, text),+ ) ?? false+ );+}++/** The first `listItem` in the document, or null when nothing wrapped. */+function firstListItem(editor: Editor): PMNode | null {+ let found: PMNode | null = null;+ editor.state.doc.descendants((node) => {+ if (found) return false;+ if (node.type.name === 'listItem') found = node;+ return !found;+ });+ return found;+}++/**+ * The document's text, so a case can assert the marker was consumed. Blocks+ * join with nothing: a rule that wraps leaves a trailing paragraph behind, and+ * a separator would make every assertion carry that artifact.+ */+function textOf(editor: Editor): string {+ return editor.state.doc.textBetween(0, editor.state.doc.content.size, '');+}++describe('task list input rules', () => {+ // The bare shorthand shared with other editors, and — because the bullet+ // rule has already eaten any leading `- ` — the only spelling a typing user+ // can actually complete.+ describe.each([+ { typed: '[] ', checked: false, sourceCheckboxChar: null },+ { typed: '[ ] ', checked: false, sourceCheckboxChar: null },+ { typed: '[x] ', checked: true, sourceCheckboxChar: null },+ { typed: '[X] ', checked: true, sourceCheckboxChar: 'X' },+ ])('bare $typed in a paragraph', ({ typed, checked, sourceCheckboxChar }) => {+ test('becomes an empty task item', () => {+ const editor = mountEditor();+ type(editor, typed);++ const item = firstListItem(editor);+ expect(item).not.toBeNull();+ expect(item?.attrs.checked).toBe(checked);+ // The non-canonical uppercase box round-trips; every other spelling+ // serializes as the canonical `[x]` / `[ ]`.+ expect(item?.attrs.sourceCheckboxChar).toBe(sourceCheckboxChar);+ expect(textOf(editor)).toBe('');+ });+ });++ // The regression. Note which rule these reach: `- ` autoformats at the space,+ // so the caret is inside the new item and its paragraph reads `[ ]` — and the+ // runner matches against the CURRENT TEXTBLOCK's text, so the marker is gone+ // from the candidate string. These therefore run the BARE rule through its+ // tick branch, not the hyphenated rule whose spelling they use. The+ // hyphenated rule is covered by the chunked-delivery block below.+ describe.each([+ { typed: '- [ ] ', checked: false },+ { typed: '- [] ', checked: false },+ { typed: '* [x] ', checked: true },+ { typed: '+ [X] ', checked: true },+ ])('typing $typed', ({ typed, checked }) => {+ test('ticks the item the bullet rule already made, without nesting', () => {+ const editor = mountEditor();+ type(editor, typed);++ const item = firstListItem(editor);+ expect(item?.attrs.checked).toBe(checked);+ expect(textOf(editor)).toBe('');+ // One item, not an item wrapping a second list holding the real one.+ let listCount = 0;+ editor.state.doc.descendants((node) => {+ if (node.type.name === 'list') listCount += 1;+ return true;+ });+ expect(listCount).toBe(1);+ });+ });++ // The hyphenated rule's only reachable route, and the only case in this file+ // that reddens if that rule is deleted. Typing cannot get here for the reason+ // above; a marker delivered whole still carries its `- `, which is what a+ // dictation or text-expansion commit looks like. Paste is NOT such a route —+ // input rules never see it, and a pasted `- [ ] ` gets its checkbox from the+ // markdown parser instead.+ describe.each([+ { chunk: '- [] ', checked: false },+ { chunk: '- [ ] ', checked: false },+ { chunk: '* [x] ', checked: true },+ ])('a whole marker delivered in one chunk: $chunk', ({ chunk, checked }) => {+ test('reaches the hyphenated rule', () => {+ const editor = mountEditor();++ expect(typeChunk(editor, chunk)).toBe(true);+ expect(firstListItem(editor)?.attrs.checked).toBe(checked);+ expect(textOf(editor)).toBe('');+ });+ });++ test('a checkbox typed into an existing item keeps its text', () => {+ const editor = mountEditor();+ type(editor, '- ');+ type(editor, '[] ');+ type(editor, 'buy milk');++ expect(firstListItem(editor)?.attrs.checked).toBe(false);+ expect(textOf(editor)).toBe('buy milk');+ });++ test('the marker is consumed, so the item serializes as canonical GFM', () => {+ const editor = mountEditor();+ type(editor, '[x] ');+ type(editor, 'done');++ const item = firstListItem(editor);+ expect(item?.attrs.checked).toBe(true);+ expect(item?.textContent).toBe('done');+ });++ describe('shapes that must stay literal text', () => {+ test.each([+ // A wikilink opener — the second `[` breaks the rule.+ '[[',+ // A reference-style link label, not a checkbox.+ '[a] ',+ '[xy] ',+ // Anchored at the textblock start, so mid-paragraph is untouched.+ 'a[] ',+ 'see [x] ',+ ])('%j stays as typed', (typed) => {+ const editor = mountEditor();+ type(editor, typed);++ expect(firstListItem(editor)).toBeNull();+ expect(textOf(editor)).toBe(typed);+ });+ });++ describe('plain list rules still win their own shapes', () => {+ test.each([+ { typed: '- ', ordered: false },+ { typed: '1. ', ordered: true },+ ])('$typed makes a plain item, not a task item', ({ typed, ordered }) => {+ const editor = mountEditor();+ type(editor, typed);++ const item = firstListItem(editor);+ expect(item?.attrs.checked).toBeNull();+ let list: PMNode | null = null;+ editor.state.doc.descendants((node) => {+ if (!list && node.type.name === 'list') list = node;+ return !list;+ });+ expect((list as PMNode | null)?.attrs.ordered).toBe(ordered);+ });+ });++ // The escape hatch, and it is NOT the same on both branches — which is why+ // each branch gets its own case. A rule that WRAPPED a paragraph inverts back+ // to that paragraph. A rule that only TICKED an existing item leaves the item+ // behind, because the bullet was an earlier, separate input-rule application+ // and `undoInputRule` inverts exactly one.+ test.each([+ '- ',+ '[x] ',+ ])('Backspace right after %j dissolves the wrapped item back to a paragraph', (typed) => {+ const editor = mountEditor();+ type(editor, typed);+ expect(firstListItem(editor)).not.toBeNull();++ const { handled } = pressEditorKey(editor, 'Backspace');++ expect(handled).toBe(true);+ expect(firstListItem(editor)).toBeNull();+ expect(editor.state.doc.firstChild?.type.name).toBe('paragraph');+ });++ test.each([+ '- [x] ',+ '- [ ] ',+ ])('Backspace right after %j un-ticks the item but leaves the bullet', (typed) => {+ const editor = mountEditor();+ type(editor, typed);+ expect(firstListItem(editor)?.attrs.checked).not.toBeNull();++ const { handled } = pressEditorKey(editor, 'Backspace');++ // The tick is undone and the typed marker comes back as text...+ expect(handled).toBe(true);+ expect(firstListItem(editor)?.attrs.checked).toBeNull();+ expect(textOf(editor)).toBe(typed.slice(2));+ // ...but the bullet is still there, so this is not the one-keystroke+ // escape the wrapped case gets. No second rule is left to invert: the+ // next Backspace goes unclaimed by any plugin and falls through to+ // ordinary character deletion.+ expect(editor.state.doc.firstChild?.type.name).toBe('list');+ expect(pressEditorKey(editor, 'Backspace').handled).toBe(false);+ });+});diff --git a/packages/core/src/bridge/bind-frontmatter-doc.ts b/packages/core/src/bridge/bind-frontmatter-doc.tsindex dfd95ef49..d7a845280 100644--- a/packages/core/src/bridge/bind-frontmatter-doc.ts+++ b/packages/core/src/bridge/bind-frontmatter-doc.ts@@ -1,4 +1,3 @@-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.tsindex 8bfdb40cd..005627195 100644--- a/packages/core/src/bridge/bridge-invariant.ts+++ b/packages/core/src/bridge/bridge-invariant.ts@@ -1,4 +1,3 @@-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.tsindex 2a597ec3d..f4cc8a286 100644--- a/packages/core/src/bridge/compose.ts+++ b/packages/core/src/bridge/compose.ts@@ -1,4 +1,3 @@-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.tsindex d979f4b39..6b505314d 100644--- a/packages/core/src/bridge/divergence-locate.ts+++ b/packages/core/src/bridge/divergence-locate.ts@@ -1,4 +1,3 @@-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.tsindex 01ef76a9f..8fb428b90 100644--- a/packages/core/src/bridge/doc-boundary-space.ts+++ b/packages/core/src/bridge/doc-boundary-space.ts@@ -1,4 +1,3 @@-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.tsindex 463e89595..9d9c244b0 100644--- a/packages/core/src/bridge/growth-detect.ts+++ b/packages/core/src/bridge/growth-detect.ts@@ -1,4 +1,3 @@-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.tsindex 0939885bb..c43fdd7e7 100644--- a/packages/core/src/bridge/intraline-predicate.ts+++ b/packages/core/src/bridge/intraline-predicate.ts@@ -1,4 +1,3 @@-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.tsindex c0dc65705..251560a35 100644--- a/packages/core/src/bridge/merge-three-way.ts+++ b/packages/core/src/bridge/merge-three-way.ts@@ -65,7 +65,6 @@ 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.tsindex dcc5b0690..01ac80099 100644--- a/packages/core/src/bridge/normalize.ts+++ b/packages/core/src/bridge/normalize.ts@@ -1,4 +1,3 @@-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.tsindex 4f7b79587..bb53e7c7c 100644--- a/packages/core/src/bridge/pm-structural-equivalence.ts+++ b/packages/core/src/bridge/pm-structural-equivalence.ts@@ -32,7 +32,6 @@ const BR_SENTINEL: PmStructuralNode = { type: '__br__' };const BR_LITERAL_RE = /^<br\s*\/?>$/i;-interface DegradeEntry {readonly label: string;readonly severity: ToleranceClassSeverity;@@ -129,7 +128,6 @@ export interface ComparePmStructuralOptions {rawSourceSide?: 'expected';}-/** 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(@@ -255,7 +253,6 @@ 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.tsindex dca644141..af20de1e2 100644--- a/packages/core/src/bridge/subsequence.ts+++ b/packages/core/src/bridge/subsequence.ts@@ -1,4 +1,3 @@-/** 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/extensions/list.test.ts b/packages/core/src/extensions/list.test.tsindex e9ba45977..2405599b6 100644--- a/packages/core/src/extensions/list.test.ts+++ b/packages/core/src/extensions/list.test.ts@@ -4,7 +4,14 @@ import Paragraph from '@tiptap/extension-paragraph';import Text from '@tiptap/extension-text';import { describe, expect, test } from 'vitest';import { MarkdownManager } from '../markdown/index.ts';-import { ListItemNode, ListNode } from './list.ts';+import {+ BULLET_INPUT_RE,+ ListItemNode,+ ListNode,+ ORDERED_INPUT_RE,+ TASK_BARE_INPUT_RE,+ TASK_MARKER_INPUT_RE,+} from './list.ts';const extensions = [Document, Paragraph, Text, ListNode, ListItemNode];const schema = getSchema(extensions);@@ -207,6 +214,35 @@ describe('list pipeline round-trip (via new MarkdownManager)', () => {expect(listNode?.attrs.bulletMarker).toBe('+');});+ // What the task-item input rules construct, on the way back out. The rules+ // accept spellings GFM does not (`[]` with nothing between the brackets), so+ // the write-back is where that widening has to disappear: every unchecked+ // spelling has to land as the canonical `- [ ] `, and only the uppercase box+ // survives as itself.+ test.each([+ { attrs: { checked: false, sourceCheckboxChar: null }, marker: '- [ ]' },+ { attrs: { checked: true, sourceCheckboxChar: null }, marker: '- [x]' },+ { attrs: { checked: true, sourceCheckboxChar: 'X' }, marker: '- [X]' },+ ])('a task item with $attrs serializes as $marker', ({ attrs, marker }) => {+ const md = mdManager.serialize({+ type: 'doc',+ content: [+ {+ type: 'list',+ attrs: { ordered: false, bulletMarker: '-' },+ content: [+ {+ type: 'listItem',+ attrs,+ content: [{ type: 'paragraph', content: [{ type: 'text', text: 'do it' }] }],+ },+ ],+ },+ ],+ });+ expect(md).toBe(`${marker} do it\n`);+ });+test('ordered list delimiter preserved', () => {const md = '1) first\n';const json = mdManager.parse(md);@@ -216,78 +252,155 @@ describe('list pipeline round-trip (via new MarkdownManager)', () => {});});-// Regression tests for the input rule priority bug.-// Before the fix, typing `- [ ] ` created a bullet list because the bullet-// rule regex /^\s*([-+*])\s$/ matched `- ` first and the task rule never-// had a chance to fire. The fix adds a negative lookahead to the bullet-// regex so it rejects patterns immediately followed by a checkbox.-describe('list input rule priority (regression for QA-013)', () => {- // Mirror of the regexes in list.ts — kept in sync manually.- // If these change in list.ts, update here AND verify the fix still holds.- const BULLET_RULE_RE = /^\s*([-+*])(?!\s*\[[ xX]\])\s$/;- const ORDERED_RULE_RE = /^\s*(\d+)([.)])\s$/;- const TASK_RULE_RE = /^\s*[-*+]\s\[([ xX])\]\s$/;-+// The bullet rule must not claim a checkbox spelling. What enforces that is the+// trailing `\s$`: the rule matches only while the marker is followed by one+// space and nothing else, so `- [` has stopped matching before the bracket is+// closed. A negative lookahead used to sit in this regex claiming the job and+// was removed — it could never fire, and an exhaustive comparison over every+// string of length <= 5 from `-+* \t[]xXa` found no input where it changed the+// verdict. These assertions are pointed at the anchor so they can fail if it+// ever loosens.+describe('bullet rule vs the checkbox spellings', () => {test('bullet rule does NOT match task list patterns', () => {- expect(BULLET_RULE_RE.test('- [ ] ')).toBe(false);- expect(BULLET_RULE_RE.test('- [x] ')).toBe(false);- expect(BULLET_RULE_RE.test('- [X] ')).toBe(false);- expect(BULLET_RULE_RE.test('* [ ] ')).toBe(false);- expect(BULLET_RULE_RE.test('+ [x] ')).toBe(false);+ expect(BULLET_INPUT_RE.test('- [ ] ')).toBe(false);+ expect(BULLET_INPUT_RE.test('- [x] ')).toBe(false);+ expect(BULLET_INPUT_RE.test('- [X] ')).toBe(false);+ expect(BULLET_INPUT_RE.test('* [ ] ')).toBe(false);+ expect(BULLET_INPUT_RE.test('+ [x] ')).toBe(false);+ });++ test('the trailing anchor is what rejects them', () => {+ // Nothing may follow the single space. That is the whole mechanism, so+ // these are the cases that would break first if the anchor loosened.+ expect(BULLET_INPUT_RE.test('- ')).toBe(true);+ expect(BULLET_INPUT_RE.test('- [')).toBe(false);+ expect(BULLET_INPUT_RE.test('- ')).toBe(false);+ expect(BULLET_INPUT_RE.test('- a')).toBe(false);});test('bullet rule matches plain bullet patterns', () => {- expect(BULLET_RULE_RE.test('- ')).toBe(true);- expect(BULLET_RULE_RE.test('* ')).toBe(true);- expect(BULLET_RULE_RE.test('+ ')).toBe(true);+ expect(BULLET_INPUT_RE.test('- ')).toBe(true);+ expect(BULLET_INPUT_RE.test('* ')).toBe(true);+ expect(BULLET_INPUT_RE.test('+ ')).toBe(true);});test('bullet rule matches with leading whitespace (nested)', () => {- expect(BULLET_RULE_RE.test(' - ')).toBe(true);- expect(BULLET_RULE_RE.test(' * ')).toBe(true);+ expect(BULLET_INPUT_RE.test(' - ')).toBe(true);+ expect(BULLET_INPUT_RE.test(' * ')).toBe(true);// And rejects task patterns even when nested- expect(BULLET_RULE_RE.test(' - [ ] ')).toBe(false);+ expect(BULLET_INPUT_RE.test(' - [ ] ')).toBe(false);});test('bullet rule captures the marker character', () => {- expect('- '.match(BULLET_RULE_RE)?.[1]).toBe('-');- expect('* '.match(BULLET_RULE_RE)?.[1]).toBe('*');- expect('+ '.match(BULLET_RULE_RE)?.[1]).toBe('+');+ expect('- '.match(BULLET_INPUT_RE)?.[1]).toBe('-');+ expect('* '.match(BULLET_INPUT_RE)?.[1]).toBe('*');+ expect('+ '.match(BULLET_INPUT_RE)?.[1]).toBe('+');});test('task rule matches task list patterns with unchecked state', () => {- const m = '- [ ] '.match(TASK_RULE_RE);+ const m = '- [ ] '.match(TASK_MARKER_INPUT_RE);expect(m).not.toBeNull();expect(m?.[1]).toBe(' ');});test('task rule matches task list patterns with checked state', () => {- const checkedLower = '- [x] '.match(TASK_RULE_RE);+ const checkedLower = '- [x] '.match(TASK_MARKER_INPUT_RE);expect(checkedLower?.[1]).toBe('x');- const checkedUpper = '- [X] '.match(TASK_RULE_RE);+ const checkedUpper = '- [X] '.match(TASK_MARKER_INPUT_RE);expect(checkedUpper?.[1]).toBe('X');});test('task rule matches with alternative bullet markers', () => {- expect(TASK_RULE_RE.test('* [ ] ')).toBe(true);- expect(TASK_RULE_RE.test('+ [x] ')).toBe(true);+ expect(TASK_MARKER_INPUT_RE.test('* [ ] ')).toBe(true);+ expect(TASK_MARKER_INPUT_RE.test('+ [x] ')).toBe(true);});test('ordered rule does not conflict with bullet or task rules', () => {// All three rules are mutually exclusive for their shapes- expect(BULLET_RULE_RE.test('1. ')).toBe(false);- expect(TASK_RULE_RE.test('1. ')).toBe(false);- expect(ORDERED_RULE_RE.test('1. ')).toBe(true);- expect(ORDERED_RULE_RE.test('- ')).toBe(false);- expect(ORDERED_RULE_RE.test('- [ ] ')).toBe(false);+ expect(BULLET_INPUT_RE.test('1. ')).toBe(false);+ expect(TASK_MARKER_INPUT_RE.test('1. ')).toBe(false);+ expect(ORDERED_INPUT_RE.test('1. ')).toBe(true);+ expect(ORDERED_INPUT_RE.test('- ')).toBe(false);+ expect(ORDERED_INPUT_RE.test('- [ ] ')).toBe(false);});test('ordered rule captures number and delimiter', () => {- const dot = '1. '.match(ORDERED_RULE_RE);+ const dot = '1. '.match(ORDERED_INPUT_RE);expect(dot?.[1]).toBe('1');expect(dot?.[2]).toBe('.');- const paren = '42) '.match(ORDERED_RULE_RE);+ const paren = '42) '.match(ORDERED_INPUT_RE);expect(paren?.[1]).toBe('42');expect(paren?.[2]).toBe(')');});++ test('bullet rule does NOT match empty-bracket task patterns', () => {+ expect(BULLET_INPUT_RE.test('- [] ')).toBe(false);+ expect(BULLET_INPUT_RE.test('* [] ')).toBe(false);+ });++ test('task rule matches the empty-bracket shorthand', () => {+ const m = '- [] '.match(TASK_MARKER_INPUT_RE);+ expect(m).not.toBeNull();+ expect(m?.[1]).toBe('');+ });+});++// The bare checkbox shorthand: `[] `, `[ ] `, `[x] `, `[X] ` with no list+// marker. This is the spelling a typing user actually produces — the bullet+// rule claims `- ` at the space, so by the time the `[` is typed the marker is+// already a listItem and TASK_MARKER_INPUT_RE has no prefix left to match. Before this+// rule existed there was NO keystroke sequence that produced a checkbox.+describe('bare task list input rule', () => {+ test('matches every accepted checkbox spelling', () => {+ expect('[] '.match(TASK_BARE_INPUT_RE)?.[1]).toBe('');+ expect('[ ] '.match(TASK_BARE_INPUT_RE)?.[1]).toBe(' ');+ expect('[x] '.match(TASK_BARE_INPUT_RE)?.[1]).toBe('x');+ expect('[X] '.match(TASK_BARE_INPUT_RE)?.[1]).toBe('X');+ });++ test('matches with leading whitespace (nested)', () => {+ expect(TASK_BARE_INPUT_RE.test(' [] ')).toBe(true);+ expect(TASK_BARE_INPUT_RE.test(' [x] ')).toBe(true);+ });++ test('does not match a wikilink opener or a bracketed word', () => {+ expect(TASK_BARE_INPUT_RE.test('[[')).toBe(false);+ expect(TASK_BARE_INPUT_RE.test('[[] ')).toBe(false);+ expect(TASK_BARE_INPUT_RE.test('[a] ')).toBe(false);+ expect(TASK_BARE_INPUT_RE.test('[xy] ')).toBe(false);+ });++ test('does not match a hyphenated marker (TASK_MARKER_INPUT_RE owns that shape)', () => {+ expect(TASK_BARE_INPUT_RE.test('- [] ')).toBe(false);+ expect(TASK_BARE_INPUT_RE.test('* [x] ')).toBe(false);+ });++ // Pinned against TipTap's own TaskItem `inputRegex`, which this rule is+ // adapted from. Both departures are deliberate; if someone later "aligns+ // with upstream" they should have to delete an assertion that says why.+ test('departs from upstream TipTap only where intended', () => {+ const TIPTAP_TASK_ITEM_RE = /^\s*(\[([( |x])?\])\s$/;++ // Agreement on every spelling that matters.+ for (const shared of ['[] ', '[ ] ', '[x] ']) {+ expect(TASK_BARE_INPUT_RE.test(shared)).toBe(true);+ expect(TIPTAP_TASK_ITEM_RE.test(shared)).toBe(true);+ }++ // Departure 1: upstream's `[( |x]` class admits `(` and `|` literally.+ expect(TIPTAP_TASK_ITEM_RE.test('[(] ')).toBe(true);+ expect(TIPTAP_TASK_ITEM_RE.test('[|] ')).toBe(true);+ expect(TASK_BARE_INPUT_RE.test('[(] ')).toBe(false);+ expect(TASK_BARE_INPUT_RE.test('[|] ')).toBe(false);++ // Departure 2: upstream cannot produce the uppercase box that+ // `sourceCheckboxChar` round-trips.+ expect(TIPTAP_TASK_ITEM_RE.test('[X] ')).toBe(false);+ expect(TASK_BARE_INPUT_RE.test('[X] ')).toBe(true);+ });++ test('is anchored to the start of the textblock', () => {+ expect(TASK_BARE_INPUT_RE.test('a[] ')).toBe(false);+ expect(TASK_BARE_INPUT_RE.test('see [x] ')).toBe(false);+ });});diff --git a/packages/core/src/extensions/list.ts b/packages/core/src/extensions/list.tsindex 984d84859..504d8540f 100644--- a/packages/core/src/extensions/list.ts+++ b/packages/core/src/extensions/list.ts@@ -135,6 +135,122 @@ function toggleListKind(return result;}+/**+ * The checkbox marker a task-item rule captured: `' '` or `''` for unchecked,+ * `x`/`X` for checked. Empty is what the bare `[]` shorthand yields.+ */+function isCheckedMarker(marker: string | undefined): boolean {+ return marker === 'x' || marker === 'X';+}++/** `'X'` only for the non-canonical uppercase spelling, which round-trips. */+function uppercaseMarker(marker: string | undefined): 'X' | null {+ return marker === 'X' ? 'X' : null;+}++/**+ * Shared body of the task-item input rules: turn a just-typed checkbox marker+ * into a real checkbox on the item that owns the caret.+ *+ * Two contexts reach this, because the same keystrokes arrive in two shapes.+ * In a plain paragraph there is no item yet, so the block wraps into a fresh+ * `list`. Inside a `listItem` there already is one — the bullet rule fires on+ * `- ` long before the `[` is typed, so the marker rule's own prefix is gone by+ * then and every hyphenated spelling lands here instead. Wrapping in that+ * branch would nest a second list inside the item rather than tick it, so it+ * only retypes the item's attrs.+ *+ * Every gate runs before the first mutation, so a refusal cannot leave the+ * marker deleted with no checkbox to show for it. The wrapping branch wraps+ * BEFORE it deletes for that reason — deleting first would need a second+ * `blockRange` lookup, and its bail would sit after a mutation.+ *+ * Returns whether it applied, so the handlers can answer `null` when it did+ * not. That is the sibling convention (`math-input-rule.ts`,+ * `inline-link-input-rule.ts`) and a real backstop: the runner discards the+ * whole transaction on a `null` handler, steps included.+ */+function applyTaskItemRule(+ state: EditorState,+ range: { from: number; to: number },+ checked: boolean,+ checkboxChar: 'X' | null,+): boolean {+ const listType = state.schema.nodes.list;+ if (!listType) return false;++ const $from = state.doc.resolve(range.from);+ const itemDepth = $from.depth - 1;++ // Caret in the FIRST block of an existing item: tick that item in place.+ // Deeper or later blocks (a blockquote in the item, a continuation+ // paragraph) are not the item's marker position, so they fall through to+ // the wrapping branch and nest, which is what the markdown would say.+ if (+ itemDepth > 0 &&+ $from.node(itemDepth).type.name === 'listItem' &&+ $from.index(itemDepth) === 0+ ) {+ const item = $from.node(itemDepth);+ state.tr.delete(range.from, range.to).setNodeMarkup($from.before(itemDepth), undefined, {+ ...item.attrs,+ checked,+ sourceCheckboxChar: checkboxChar,+ });+ return true;+ }++ const blockRange = $from.blockRange();+ if (!blockRange) return false;+ // Gate on the pre-delete doc: `findWrapping` returns node-type descriptors+ // rather than positions, so the result stays valid across the deletion, and+ // deciding here is what keeps a refusal from leaving a bare deletion behind.+ const wrapping = findWrapping(blockRange, listType, { ordered: false });+ if (!wrapping) return false;++ // Past the last gate, so both steps land or neither does. Wrap first and+ // delete through the mapping: the wrap shifts every position after the+ // block's start, and asking the mapping is cheaper than re-deriving the+ // range and safer than assuming the delete left one behind.+ const tr = state.tr;+ tr.wrap(blockRange, wrapping);+ tr.delete(tr.mapping.map(range.from), tr.mapping.map(range.to));++ const $item = tr.doc.resolve(tr.mapping.map(range.from));+ for (let d = $item.depth; d > 0; d--) {+ const parentNode = $item.node(d);+ if (parentNode.type.name === 'listItem') {+ tr.setNodeMarkup($item.before(d), undefined, {+ ...parentNode.attrs,+ checked,+ sourceCheckboxChar: checkboxChar,+ });+ break;+ }+ }+ return true;+}++/**+ * The four input-rule patterns, named so the suite can assert against the+ * shipped values instead of a transcription. They were literals inside+ * `addInputRules` behind a keep-in-sync-manually comment, and drifted: the+ * mirrored bullet pattern kept a lookahead the real one no longer needed, so+ * the tests proving it excluded `- [ ] ` passed with it deleted.+ *+ * Each is anchored to the start of a textblock and ends at the caret; the+ * trailing `\s$` is load-bearing on all four, and on the bullet rule it is the+ * whole reason a checkbox spelling never reaches it.+ */+/** `- `, `* `, `+ ` — a plain bullet. */+export const BULLET_INPUT_RE = /^\s*([-+*])\s$/;+/** `1. `, `42) ` — an ordered marker, ordinal and delimiter captured. */+export const ORDERED_INPUT_RE = /^\s*(\d+)([.)])\s$/;+/** `- [ ] `, `* [x] ` — a checkbox WITH its list marker still attached. */+export const TASK_MARKER_INPUT_RE = /^\s*[-*+]\s\[([ xX]?)\]\s$/;+/** `[] `, `[ ] `, `[x] `, `[X] ` — a bare checkbox. */+export const TASK_BARE_INPUT_RE = /^\s*\[([ xX]?)\]\s$/;+// ────────────────────────── List Node ──────────────────────────export const ListNode = Node.create({@@ -235,14 +351,21 @@ export const ListNode = Node.create({addInputRules() {return [- // Bullet list: - , * , + (negative lookahead excludes task list pattern `- [ ] `)+ // Bullet list: - , * , + . The trailing `\s$` is what keeps the checkbox+ // spellings out, not a lookahead: the rule only matches while the marker+ // is followed by one space and nothing else, so `- [` has already stopped+ // matching before the bracket is closed. A `(?!\s*\[[ xX]?\])` guard+ // used to sit here claiming that job; it could never fire (the lookahead+ // body needs two characters and only the one space is ever left to read)+ // and every input agreed with it removed.+ //// joinPredicate: bullet and ordered lists share the single `list` node// type (distinguished by the `ordered` attr), so the default same-type// join would merge a freshly-typed list into ANY adjacent list. Only// join when the preceding list is the same kind — otherwise typing// `1. ` below a bullet list silently became an empty bullet item.wrappingInputRule({- find: /^\s*([-+*])(?!\s*\[[ xX]\])\s$/,+ find: BULLET_INPUT_RE,type: this.type,getAttributes: (match) => ({ordered: false,@@ -252,7 +375,7 @@ export const ListNode = Node.create({}),// Ordered list: 1. or 1)wrappingInputRule({- find: /^\s*(\d+)([.)])\s$/,+ find: ORDERED_INPUT_RE,type: this.type,getAttributes: (match) => ({ordered: true,@@ -261,38 +384,48 @@ export const ListNode = Node.create({}),joinPredicate: (_match, node) => node.attrs.ordered === true,}),- // Task list: - [ ] or - [x]+ // Task list, hyphenated: `- [ ] `, `* [x] `, `+ [] `. Typing never reaches+ // this rule. The bullet rule above claims `- ` at the space, and the+ // runner matches against the CURRENT TEXTBLOCK's text, so by the time the+ // `[` is typed the marker is gone from the candidate string — the bare+ // rule below is what a keystroke sequence actually hits.+ //+ // Its one live route is a multi-character `handleTextInput` delivery: an+ // IME commit, dictation, autocorrect, or a text-expansion tool handing+ // over the finished marker in a single call, which still carries the+ // `- `. NOT paste — the input-rules plugin registers only+ // handleTextInput / handleKeyDown / compositionend, so pasted text never+ // reaches any input rule, and a pasted `- [ ] ` gets its checkbox from+ // `MarkdownManager.parse` on the clipboard path instead. Nor+ // `insertContent` / `setContent`, which dispatch transactions directly.new InputRule({- find: /^\s*[-*+]\s\[([ xX])\]\s$/,- handler: ({ state, range, match }) => {- const listType = state.schema.nodes.list;- if (!listType) return null;-- const checked = match[1] !== ' ';- const tr = state.tr.delete(range.from, range.to);-- const $start = tr.doc.resolve(range.from);- const blockRange = $start.blockRange();- if (!blockRange) return null;-- const wrapping = findWrapping(blockRange, listType, { ordered: false });- if (!wrapping) return null;-- tr.wrap(blockRange, wrapping);-- // Find the newly created listItem and set checked- const $newPos = tr.doc.resolve(tr.mapping.map(range.from));- for (let d = $newPos.depth; d > 0; d--) {- const parentNode = $newPos.node(d);- if (parentNode.type.name === 'listItem') {- tr.setNodeMarkup($newPos.before(d), undefined, {- ...parentNode.attrs,- checked,- });- break;- }- }- },+ find: TASK_MARKER_INPUT_RE,+ handler: ({ state, range, match }) =>+ applyTaskItemRule(state, range, isCheckedMarker(match[1]), uppercaseMarker(match[1]))+ ? undefined+ : null,+ }),+ // Task list, bare: `[] `, `[ ] `, `[x] `, `[X] `. This is TipTap's own+ // TaskItem rule (`inputRegex` in `@tiptap/extension-list`), which we+ // cannot use directly — it wraps into a `taskItem` node, and this schema+ // unified TaskList/TaskItem into `list`/`listItem` to stay+ // mdast-canonical. Two deliberate departures from its pattern:+ //+ // - `[ xX]` where upstream has `[( |x]`. That class admits `(` and `|`+ // literally, which reads as a slipped alternation `( |x)`; matching+ // `[(] ` as a checkbox is not a behavior to copy.+ // - `X` accepted, which upstream drops. `sourceCheckboxChar` exists so+ // an authored `- [X] ` round-trips, so the rule has to be able to+ // produce that state in the first place.+ //+ // Empty brackets are not GFM, but they are a trigger, not a+ // serialization: every spelling writes back as the canonical `- [ ] `.+ new InputRule({+ find: TASK_BARE_INPUT_RE,+ handler: ({ state, range, match }) =>+ applyTaskItemRule(state, range, isCheckedMarker(match[1]), uppercaseMarker(match[1]))+ ? undefined+ : null,}),];},diff --git a/packages/core/src/markdown/callout-transformer.ts b/packages/core/src/markdown/callout-transformer.tsindex a363dfd54..83d47404a 100644--- a/packages/core/src/markdown/callout-transformer.ts+++ b/packages/core/src/markdown/callout-transformer.ts@@ -1,4 +1,3 @@-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.tsindex 4499dbc92..9807a7e82 100644--- a/packages/core/src/markdown/code-fence.ts+++ b/packages/core/src/markdown/code-fence.ts@@ -1,4 +1,3 @@-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.tsindex 6e3c6d088..e3a4af858 100644--- a/packages/core/src/markdown/comment-promoter.ts+++ b/packages/core/src/markdown/comment-promoter.ts@@ -1,4 +1,3 @@-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.tsindex b6299a948..ece5c02a1 100644--- a/packages/core/src/markdown/dedent-block-jsx-close.ts+++ b/packages/core/src/markdown/dedent-block-jsx-close.ts@@ -1,4 +1,3 @@-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.tsindex acd398aa6..54774764a 100644--- a/packages/core/src/markdown/details-accordion-promoter.ts+++ b/packages/core/src/markdown/details-accordion-promoter.ts@@ -1,4 +1,3 @@-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.tsindex ba9b56384..43ecdc709 100644--- a/packages/core/src/markdown/div-align-promoter.ts+++ b/packages/core/src/markdown/div-align-promoter.ts@@ -1,4 +1,3 @@-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.tsindex 4513da9bb..6d3f3643e 100644--- a/packages/core/src/markdown/fence-regions.ts+++ b/packages/core/src/markdown/fence-regions.ts@@ -1,4 +1,3 @@-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.tsindex 6931623c7..00f5771ee 100644--- a/packages/core/src/markdown/fixtures/index.ts+++ b/packages/core/src/markdown/fixtures/index.ts@@ -1,4 +1,3 @@-import { readFileSync } from 'node:fs';import { dirname, resolve } from 'node:path';import { fileURLToPath } from 'node:url';@@ -9,7 +8,6 @@ function fixturePath(...segments: string[]): string {return resolve(FIXTURES_DIR, ...segments);}-interface GfmExample {section: string;markdown: string;@@ -19,7 +17,6 @@ export function loadGfmExamples(): GfmExample[] {return JSON.parse(readFileSync(fixturePath('gfm', 'examples.json'), 'utf8')) as GfmExample[];}-interface MdxCrashEntry {id: string;input: string;@@ -71,7 +68,6 @@ export function loadLargeEmbedFixtures(): LargeEmbedFixture[] {) as LargeEmbedFixture[];}-export function loadPrd6955Before(): string {return readFileSync(fixturePath('regression', 'prd-6955-before.md'), 'utf8');}@@ -80,7 +76,6 @@ export function loadPrd6955CorruptedTriplicated(): string {return readFileSync(fixturePath('regression', 'prd-6955-corrupted-triplicated.md'), 'utf8');}-export interface NgPinnedCase {id: string;name: string;@@ -97,7 +92,6 @@ 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.tsindex daa3ef82b..8b1eb8519 100644--- a/packages/core/src/markdown/fixtures/perf/generate.ts+++ b/packages/core/src/markdown/fixtures/perf/generate.ts@@ -1,4 +1,3 @@-import { writeFileSync } from 'node:fs';import { dirname, resolve } from 'node:path';import { fileURLToPath } from 'node:url';@@ -11,7 +10,6 @@ const BASELINE_ONLY_COUNTS = [500, 2500] as const;const SEED = 0xf1de1117;-function mulberry32(seed: number): () => number {let a = seed >>> 0;return () => {@@ -38,7 +36,6 @@ function pickWeighted<T>(rand: () => number, items: readonly [T, number][]): T {return items[items.length - 1][0];}-const WORDS = ['lorem','ipsum',@@ -156,7 +153,6 @@ 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][] = [@@ -195,7 +191,6 @@ 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.tsindex 32c055c5b..420dc0fe5 100644--- a/packages/core/src/markdown/guard-flanking-matrix.ts+++ b/packages/core/src/markdown/guard-flanking-matrix.ts@@ -7,7 +7,6 @@ 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.tsindex 283913255..2653473da 100644--- a/packages/core/src/markdown/handler-shadow-audit.ts+++ b/packages/core/src/markdown/handler-shadow-audit.ts@@ -1,4 +1,3 @@-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.tsindex e56707b48..ee6d25fda 100644--- a/packages/core/src/markdown/highlight-promoter.ts+++ b/packages/core/src/markdown/highlight-promoter.ts@@ -1,4 +1,3 @@-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.tsindex 9681c0056..787315157 100644--- a/packages/core/src/markdown/html-to-mdast.ts+++ b/packages/core/src/markdown/html-to-mdast.ts@@ -1,4 +1,3 @@-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';@@ -129,8 +128,7 @@ export function htmlToMdast(html: string, options?: HtmlToMdastOptions): MdastRothrow 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.tsindex 994eb6917..706fa9afb 100644--- a/packages/core/src/markdown/image-promoter.ts+++ b/packages/core/src/markdown/image-promoter.ts@@ -1,4 +1,3 @@-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.tsindex ec1ac1b7e..779e27500 100644--- a/packages/core/src/markdown/index.ts+++ b/packages/core/src/markdown/index.ts@@ -1,4 +1,3 @@-import {type FromProseMirrorOptions,fromPmMark,@@ -207,7 +206,6 @@ export class MarkdownManager {}}-const registry = createRegistry();function destructureAttrs(@@ -256,7 +254,6 @@ function destructureAttrs(return result;}-function hasDirtyDescendant(node: PmNode): boolean {let found = false;node.descendants((child) => {@@ -279,7 +276,6 @@ function effectiveDirty(node: PmNode, freshnessChecker?: StructuralFreshnessChecreturn freshnessChecker ? freshnessChecker.isDiverged(node.toJSON()) : false;}-function isEmptyMdastParagraph(node: MdastNodes): boolean {if (node.type !== 'paragraph') return false;const children = node.children ?? [];@@ -348,7 +344,6 @@ function extractTextFromMdastNodes(nodes: MdastNodes[]): string {return out;}-import {AUDIO_EXTENSIONS,FILE_ATTACHMENT_EXTENSIONS,@@ -601,7 +596,6 @@ function buildMdastToPmHandlers(}));}-if (m.emphasis) {handlers.emphasis = toPmMark(m.emphasis, (node: Emphasis) => ({sourceDelimiter: node.data?.sourceDelimiter ?? '*',@@ -682,7 +676,6 @@ function buildMdastToPmHandlers(}));}-if (m.link) {const sourceLiteralMark = m.sourceLiteral;handlers.link = (node: Link, _parent: MdastParent, state: MdastToPmState) => {@@ -980,7 +973,6 @@ function buildMdastToPmHandlers(};}-const blockUnknownHandler = (node: {type: string;position?: { start: { offset: number }; end: { offset: number } };@@ -1106,7 +1098,6 @@ 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.tsindex b79e9aef7..fa0be9e86 100644--- a/packages/core/src/markdown/lint/applies-to.ts+++ b/packages/core/src/markdown/lint/applies-to.ts@@ -1,4 +1,3 @@-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.tsindex 94b34dee1..312c9c74b 100644--- a/packages/core/src/markdown/lint/config-files.ts+++ b/packages/core/src/markdown/lint/config-files.ts@@ -1,4 +1,3 @@-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.tsindex 7c54c0a73..cc667b93e 100644--- a/packages/core/src/markdown/lint/config-schemas.ts+++ b/packages/core/src/markdown/lint/config-schemas.ts@@ -52,7 +52,6 @@ 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.tsindex a51f2ffb0..d48eea5e4 100644--- a/packages/core/src/markdown/lint/default-config.ts+++ b/packages/core/src/markdown/lint/default-config.ts@@ -6,7 +6,6 @@ export const DEFAULT_MARKDOWNLINT_CONFIG: Record<string, MarkdownlintRuleSettingMD013: 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.tsindex 9c9542661..ef478e268 100644--- a/packages/core/src/markdown/lint/frontmatter-schema-edit.ts+++ b/packages/core/src/markdown/lint/frontmatter-schema-edit.ts@@ -1,4 +1,3 @@-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.tsindex a19b298ce..1943ac84f 100644--- a/packages/core/src/markdown/lint/frontmatter-validate.ts+++ b/packages/core/src/markdown/lint/frontmatter-validate.ts@@ -1,4 +1,3 @@-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.tsindex 26fbc2b22..781226a5d 100644--- a/packages/core/src/markdown/lint/index.ts+++ b/packages/core/src/markdown/lint/index.ts@@ -1,4 +1,3 @@-import type { LintPluginFailureReporter } from './plugin-failure.ts';import { isLintPluginSelected, LINT_PLUGINS, type LinterConfig } from './plugins.ts';import type { LintDiagnostic } from './types.ts';@@ -80,8 +79,7 @@ function renderErrorMessage(error: unknown, depth = 0): string {try {const json = JSON.stringify(error);if (json !== undefined) return json;- } catch {- }+ } catch {}}return String(error);}diff --git a/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts b/packages/core/src/markdown/lint/okf-frontmatter/materialize.tsindex f438f1b16..7a5af097e 100644--- a/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts+++ b/packages/core/src/markdown/lint/okf-frontmatter/materialize.ts@@ -1,4 +1,3 @@-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.tsindex c290b6878..1ee913527 100644--- a/packages/core/src/markdown/lint/okf-frontmatter/paths.ts+++ b/packages/core/src/markdown/lint/okf-frontmatter/paths.ts@@ -1,4 +1,3 @@-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.tsindex 53ecb619d..f325fbbb4 100644--- a/packages/core/src/markdown/lint/okf-frontmatter/registry.ts+++ b/packages/core/src/markdown/lint/okf-frontmatter/registry.ts@@ -1,4 +1,3 @@-import { compileAppliesTo } from '../applies-to.ts';import { validateFrontmatterSource } from '../frontmatter-validate.ts';import {diff --git a/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts b/packages/core/src/markdown/lint/okf-frontmatter/schemas.tsindex f700795d2..ed9e2efcf 100644--- a/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts+++ b/packages/core/src/markdown/lint/okf-frontmatter/schemas.ts@@ -1,4 +1,3 @@-// file-level form is deliberate: the sibling `biome-ignore` must sit on the line// oxlint-disable unicorn/no-thenablediff --git a/packages/core/src/markdown/lint/okf-project/rules.ts b/packages/core/src/markdown/lint/okf-project/rules.tsindex 8b476332e..6d691ae2b 100644--- a/packages/core/src/markdown/lint/okf-project/rules.ts+++ b/packages/core/src/markdown/lint/okf-project/rules.ts@@ -1,4 +1,3 @@-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.tsindex 44913a9dc..4de50d79f 100644--- a/packages/core/src/markdown/lint/okf-rule-meta.ts+++ b/packages/core/src/markdown/lint/okf-rule-meta.ts@@ -1,4 +1,3 @@-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.tsindex d0999b62e..1d5538421 100644--- a/packages/core/src/markdown/lint/okf-rules.ts+++ b/packages/core/src/markdown/lint/okf-rules.ts@@ -1,4 +1,3 @@-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.tsindex fabb08d6e..de130e3f4 100644--- a/packages/core/src/markdown/lint/okf-runner.ts+++ b/packages/core/src/markdown/lint/okf-runner.ts@@ -1,4 +1,3 @@-import type { Root } from 'mdast';import remarkFrontmatter from 'remark-frontmatter';import remarkGfm from 'remark-gfm';diff --git a/packages/core/src/markdown/lint/plugin-failure.ts b/packages/core/src/markdown/lint/plugin-failure.tsindex 1cd0d2543..e7d694890 100644--- a/packages/core/src/markdown/lint/plugin-failure.ts+++ b/packages/core/src/markdown/lint/plugin-failure.ts@@ -1,4 +1,3 @@-import type { LintPluginId } from './types.ts';export interface LintPluginFailure {diff --git a/packages/core/src/markdown/lint/plugins.ts b/packages/core/src/markdown/lint/plugins.tsindex 1dae8316d..e7455ccf7 100644--- a/packages/core/src/markdown/lint/plugins.ts+++ b/packages/core/src/markdown/lint/plugins.ts@@ -1,4 +1,3 @@-import { z } from 'zod';import { DEFAULT_MARKDOWNLINT_CONFIG, resolveMarkdownlintConfig } from './default-config.ts';import {@@ -24,7 +23,6 @@ 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.tsindex fcbb1b56c..59fe9b87d 100644--- a/packages/core/src/markdown/lint/rules/index-shape.ts+++ b/packages/core/src/markdown/lint/rules/index-shape.ts@@ -1,4 +1,3 @@-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.tsindex 431e4e9c8..e0159519f 100644--- a/packages/core/src/markdown/lint/rules/log-shape.ts+++ b/packages/core/src/markdown/lint/rules/log-shape.ts@@ -1,4 +1,3 @@-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.tsindex f75a04d15..2123e977f 100644--- a/packages/core/src/markdown/lint/rules/no-wiki-links.ts+++ b/packages/core/src/markdown/lint/rules/no-wiki-links.ts@@ -1,4 +1,3 @@-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.tsindex c8b4d8f28..89ef3e4a9 100644--- a/packages/core/src/markdown/lint/rules/reserved-casing.ts+++ b/packages/core/src/markdown/lint/rules/reserved-casing.ts@@ -1,4 +1,3 @@-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.tsindex 594830b88..2cffecae6 100644--- a/packages/core/src/markdown/lint/types.ts+++ b/packages/core/src/markdown/lint/types.ts@@ -1,4 +1,3 @@-import type { BrokenLinkReason } from '../../schemas/api/agent-write.ts';import type { OkfRuleId } from './okf-rule-meta.ts';@@ -113,7 +112,6 @@ 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.tsindex 437cc539a..98238656e 100644--- a/packages/core/src/markdown/lint/validation-counts.ts+++ b/packages/core/src/markdown/lint/validation-counts.ts@@ -1,4 +1,3 @@-export interface ValidationSourceCounts {errorCount: number;warningCount: number;diff --git a/packages/core/src/markdown/math-promoter.ts b/packages/core/src/markdown/math-promoter.tsindex bd79424c7..a5b511f25 100644--- a/packages/core/src/markdown/math-promoter.ts+++ b/packages/core/src/markdown/math-promoter.ts@@ -1,4 +1,3 @@-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.tsindex 00fbc0035..ed89371d0 100644--- a/packages/core/src/markdown/mdast-to-hast-handlers.ts+++ b/packages/core/src/markdown/mdast-to-hast-handlers.ts@@ -1,4 +1,3 @@-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.tsindex df788a80d..8ce2b2492 100644--- a/packages/core/src/markdown/mdast-to-html.ts+++ b/packages/core/src/markdown/mdast-to-html.ts@@ -1,4 +1,3 @@-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.tsindex fa3cfcd86..bfd7e3109 100644--- a/packages/core/src/markdown/merged-walker.ts+++ b/packages/core/src/markdown/merged-walker.ts@@ -1,4 +1,3 @@-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.tsindex 17ed2b829..1a897fca8 100644--- a/packages/core/src/markdown/mermaid-promoter.ts+++ b/packages/core/src/markdown/mermaid-promoter.ts@@ -1,4 +1,3 @@-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.tsindex 4aa0490c4..d988f4b8b 100644--- a/packages/core/src/markdown/parse-with-fallback.ts+++ b/packages/core/src/markdown/parse-with-fallback.ts@@ -168,7 +168,6 @@ export function parseRecursive(}}-interface VFilePlace {offset?: number;start?: { offset?: number };@@ -187,7 +186,6 @@ function extractErrorOffset(err: unknown): number | undefined {return undefined;}-interface Region {start: number;end: number;@@ -211,7 +209,6 @@ function nearestBlankLineAfter(src: string, offset: number): number | null {return null;}-export interface TagEvent {kind: 'open' | 'close' | 'self-close';name: string;@@ -358,7 +355,6 @@ function findFallbackRegion(src: string, errorOffset: number): Region {return { start: blockStart, end: blockEnd };}-interface SourceBlock {src: string;start: number;@@ -456,7 +452,6 @@ 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.tsindex 43d420187..e6ab4fd57 100644--- a/packages/core/src/markdown/parser-drop-closure.ts+++ b/packages/core/src/markdown/parser-drop-closure.ts@@ -1,4 +1,3 @@-export type DroppedTokenAdjudication =| {kind: 'format-dof-axis';diff --git a/packages/core/src/markdown/pipeline.ts b/packages/core/src/markdown/pipeline.tsindex 55736041c..0e3224206 100644--- a/packages/core/src/markdown/pipeline.ts+++ b/packages/core/src/markdown/pipeline.ts@@ -1,4 +1,3 @@-import {type FromProseMirrorOptions,fromProseMirror,diff --git a/packages/core/src/markdown/position-aware-join.ts b/packages/core/src/markdown/position-aware-join.tsindex ccf06e94d..91cdf658f 100644--- a/packages/core/src/markdown/position-aware-join.ts+++ b/packages/core/src/markdown/position-aware-join.ts@@ -1,4 +1,3 @@-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.tsindex e5b4c9eba..0f399d34c 100644--- a/packages/core/src/markdown/position-slice.ts+++ b/packages/core/src/markdown/position-slice.ts@@ -1,4 +1,3 @@-import type { Nodes, Root } from 'mdast';import { visit } from 'unist-util-visit';import type { VFile } from 'vfile';@@ -477,8 +476,7 @@ 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.tsindex ca225ce9b..db10fa54b 100644--- a/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts+++ b/packages/core/src/markdown/rehype-plugins/skip-notion-whitespace.ts@@ -1,4 +1,3 @@-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.tsindex 3a2524a9a..34068d103 100644--- a/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-cocoa-meta.ts@@ -1,4 +1,3 @@-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.tsindex 2279a0189..93151d43b 100644--- a/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-gdocs-wrapper.ts@@ -1,4 +1,3 @@-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.tsindex a0f467c42..188f02d83 100644--- a/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-github-hovercard.ts@@ -1,4 +1,3 @@-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.tsindex 4e8542a21..4ba2c3418 100644--- a/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-gmail-classes.ts@@ -1,4 +1,3 @@-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.tsindex a3c96b24a..1a74b1272 100644--- a/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-gsheets-wrapper.ts@@ -1,4 +1,3 @@-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.tsindex e95cf43d6..de35e7b79 100644--- a/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-mso-styles.ts@@ -1,4 +1,3 @@-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.tsindex ffdb4d5b5..b4be1b2ea 100644--- a/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-slack-classes.ts@@ -1,4 +1,3 @@-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.tsindex e2a96d1a7..3c8d88b7c 100644--- a/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts+++ b/packages/core/src/markdown/rehype-plugins/strip-vscode-spans.ts@@ -1,4 +1,3 @@-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.tsindex 0389575ac..cf2c9da8e 100644--- a/packages/core/src/markdown/resolve-image-url.ts+++ b/packages/core/src/markdown/resolve-image-url.ts@@ -1,4 +1,3 @@-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.tsindex 8be632ba4..4d3250d3a 100644--- a/packages/core/src/markdown/safe-url.ts+++ b/packages/core/src/markdown/safe-url.ts@@ -1,4 +1,3 @@-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.tsindex 96304e7a5..0dd54070e 100644--- a/packages/core/src/markdown/serialize-fidelity.test-helper.ts+++ b/packages/core/src/markdown/serialize-fidelity.test-helper.ts@@ -1,4 +1,3 @@-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.tsindex 93798cf83..7cac5b042 100644--- a/packages/core/src/markdown/serialize-helpers.ts+++ b/packages/core/src/markdown/serialize-helpers.ts@@ -1,4 +1,3 @@-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.tsindex 8c08b7a04..b012a5aff 100644--- a/packages/core/src/markdown/single-dollar-math-promoter.ts+++ b/packages/core/src/markdown/single-dollar-math-promoter.ts@@ -1,4 +1,3 @@-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.tsindex 83d4af672..b50bea5ec 100644--- a/packages/core/src/markdown/to-markdown-handlers.ts+++ b/packages/core/src/markdown/to-markdown-handlers.ts@@ -1,4 +1,3 @@-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.tsindex 6e6d73400..0f1b0f27d 100644--- a/packages/core/src/markdown/underline-promoter.ts+++ b/packages/core/src/markdown/underline-promoter.ts@@ -1,4 +1,3 @@-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.tsindex 932d7d2a8..1a082bda7 100644--- a/packages/core/src/markdown/unknown-mdast-guard.ts+++ b/packages/core/src/markdown/unknown-mdast-guard.ts@@ -1,4 +1,3 @@-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.tsindex ac9f5239b..d578476a7 100644--- a/packages/core/src/markdown/whitespace-char-ref.ts+++ b/packages/core/src/markdown/whitespace-char-ref.ts@@ -1,4 +1,3 @@-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.tsindex afd9936fe..6dad26200 100644--- a/packages/core/src/markdown/wiki-link-micromark.ts+++ b/packages/core/src/markdown/wiki-link-micromark.ts@@ -17,7 +17,6 @@ declare module 'micromark-util-types' {}}-const CODE_BANG = 33; // !const CODE_LBRACKET = 91; // [const CODE_RBRACKET = 93; // ]@@ -261,7 +260,6 @@ export function wikiLinkSyntax(): Extension {};}-function enterWikiLink(this: CompileContext, token: Token) {this.enter({@@ -387,7 +385,6 @@ export const wikiLinkToMarkdown: {unsafe: [{ character: '[', inConstruct: ['phrasing'] }],};-const MICROMARK_EXT = wikiLinkSyntax();export function remarkWikiLink(this: Processor) {