Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(open-knowledge): stop ACP follow-file yanking the editor mid-read (PRD-7689) (#3292)

Abraham4a5778ca9ce0
diff --git a/.changeset/follow-file-active-thread-only.md b/.changeset/follow-file-active-thread-only.md
new file mode 100644
index 000000000..7b6059929
--- /dev/null
+++ b/.changeset/follow-file-active-thread-only.md
@@ -0,0 +1,10 @@
+---
+'@inkeep/open-knowledge': patch
+---
+
+The editor no longer jumps to a different file on its own while you're reading. Follow-the-file — the feature that walks the editor along as an agent creates and edits pages — was doing two things it shouldn't:
+
+- **A background agent could steal your place.** Every open agent conversation stays live at once, so an agent working in a tab you weren't looking at could still yank the editor onto whatever file it wrote next. Now only the conversation you're actively viewing (its tab selected, the dock on screen) moves the editor.
+- **It overrode where you navigated.** If you opened another page to read while an agent kept working, its next write pulled you back. Now, once you navigate somewhere the agent didn't send you, follow steps aside and leaves you there for the rest of that turn. It picks back up on the next turn, or when you toggle follow off and on.
+
+Follow still does its job on the golden path: start an agent, watch the editor track its work. Turn the follow toggle off in the conversation header to opt out entirely.
diff --git a/knip.config.ts b/knip.config.ts
index bbc8ca7cb..13a6b9fb3 100644
--- a/knip.config.ts
+++ b/knip.config.ts
@@ -123,9 +123,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/components/SessionsHost.tsx b/packages/app/src/components/SessionsHost.tsx
index e07953dc4..fd7519801 100644
--- a/packages/app/src/components/SessionsHost.tsx
+++ b/packages/app/src/components/SessionsHost.tsx
@@ -1550,6 +1550,15 @@ export function SessionsHost({
// transcript only — never while a terminal (or another thread) is
// focused, and never when the channel is healthy.
showConnectionBanner={threadConnectionDown && session.id === activeSessionId}
+ // Only the actively-viewed thread (selected tab + dock on
+ // screen) drives follow-the-file; a hidden background thread's
+ // agent write must not yank the editor off the user's page.
+ // Gates on `visible`, not `isShowing`, because `isShowing` dips
+ // for a commit whenever the container's callback ref
+ // re-attaches (see the focus-management block below) — using
+ // it here would drop a follow tick for no user-visible
+ // reason. `visible` is the stable "dock is on screen" signal.
+ active={visible && session.id === activeSessionId}
/>
)}
</TabsContent>
@@ -1587,10 +1596,13 @@ function ThreadPanel({
threadId,
info,
showConnectionBanner,
+ active,
}: {
threadId: string;
info: ThreadInfo | undefined;
showConnectionBanner: boolean;
+ /** The user is actively viewing this thread — gates follow-the-file. */
+ active: boolean;
}) {
if (info === undefined) return null;
return (
@@ -1607,7 +1619,7 @@ function ThreadPanel({
</div>
}
>
- <ThreadView key={threadId} info={info} />
+ <ThreadView key={threadId} info={info} active={active} />
</Suspense>
</>
);
diff --git a/packages/app/src/components/acp/ThreadView.tsx b/packages/app/src/components/acp/ThreadView.tsx
index b99cfe2fb..5caa30e56 100644
--- a/packages/app/src/components/acp/ThreadView.tsx
+++ b/packages/app/src/components/acp/ThreadView.tsx
@@ -123,6 +123,9 @@ import { useWorkspace } from '@/lib/use-workspace';
import { cn } from '@/lib/utils';
import { AgentMarkdown } from './AgentMarkdown';
import {
+ decideFollowNavigation,
+ type FollowNavState,
+ INITIAL_FOLLOW_NAV_STATE,
latestFollowTarget,
loadFollowFilePref,
pageListFollowOptions,
@@ -192,7 +195,22 @@ function isRetryableFailure(failure: ThreadFailureDetail): boolean {
return RETRYABLE_FAILURE_REASONS.has(failure.reason);
}
-export function ThreadView({ info }: { info: ThreadInfo }): ReactNode {
+export function ThreadView({
+ info,
+ active = true,
+}: {
+ info: ThreadInfo;
+ /**
+ * Whether the user is actively viewing this thread (its tab is selected AND
+ * the sessions dock is on screen). Every open thread's ThreadView stays
+ * mounted at once (the dock force-mounts panels so transcripts survive tab
+ * switches), so without this gate a background thread's agent write would
+ * yank the editor's follow-the-file navigation out from under a user reading
+ * an unrelated page. Only the actively-viewed thread drives follow. Defaults
+ * true so a lone ThreadView (tests, any single-thread host) still follows.
+ */
+ active?: boolean;
+}): ReactNode {
const { t } = useLingui();
const state = useAgentThread(info.threadId);
const client = getAgentThreadClient();
@@ -204,10 +222,12 @@ export function ThreadView({ info }: { info: ThreadInfo }): ReactNode {
const scrollApiRef = useRef<ReturnType<typeof useMessageScroller> | null>(null);
// Follow-the-file bookkeeping: `initialSeqRef` marks the event log position
// at mount so a replayed history (reload, tab switch) never yanks the
- // editor around — only events that arrive live do. `lastFollowedRef`
- // dedupes so each target navigates once.
+ // editor around — only events that arrive live do. `followNavRef` carries the
+ // last-followed target + the yield latch across events (see
+ // decideFollowNavigation); it re-arms per turn and on the follow toggle.
const initialSeqRef = useRef<number | null>(null);
- const lastFollowedRef = useRef<string | null>(null);
+ const followNavRef = useRef<FollowNavState>(INITIAL_FOLLOW_NAV_STATE);
+ const prevTurnActiveRef = useRef(false);
// A selection send (⌘J) or Problems-panel "Ask AI" that resolved to this agent
// seeds the composer instead of auto-sending, so the user reviews and extends
@@ -347,28 +367,56 @@ export function ThreadView({ info }: { info: ThreadInfo }): ReactNode {
if (!canRetry) setRetryPending(false);
}, [canRetry]);
+ // Re-arm follow at the start of each turn: a new turn is the user directing
+ // the agent again, so a yield latched during the previous turn (they read
+ // another page) is cleared and follow tracks the new work afresh.
+ //
+ // Preserve `lastFollowed` — resetting it would lose the same-target dedupe
+ // that keeps a stale `followTarget` (carried across turns via the
+ // accumulated event log) from yanking the user to yesterday's work the
+ // instant they press send. Set `reArmed` so the NEXT fresh target this
+ // turn bypasses the off-track check exactly once — the user's new intent
+ // beats their prior yield.
+ //
+ // Defined before the follow effect so the reset lands before the
+ // same-commit follow.
+ useEffect(() => {
+ if (turnActive && !prevTurnActiveRef.current) {
+ followNavRef.current = { ...followNavRef.current, yielded: false, reArmed: true };
+ }
+ prevTurnActiveRef.current = turnActive;
+ }, [turnActive]);
+
// Follow the agent's file: navigate the editor to the doc the agent is
- // working on, as it works. Live events only (see initialSeqRef above), and
- // only while a turn is streaming — an idle thread never steals navigation.
+ // working on, as it works. Gated four ways: only when following is on, only
+ // while a turn is streaming, only on live events (see initialSeqRef above),
+ // and only for the actively-viewed thread (`active`) — a background thread's
+ // write must never yank a reader off their page. `decideFollowNavigation`
+ // owns the dedupe + yield-to-manual-navigation policy.
useEffect(() => {
- if (!followFile || followTarget === null) return;
- if (!turnActive) return;
+ if (!active || !followFile || followTarget === null || !turnActive) return;
if (initialSeqRef.current === null || lastSeq === null || lastSeq <= initialSeqRef.current) {
return;
}
- if (lastFollowedRef.current === followTarget) return;
- lastFollowedRef.current = followTarget;
- if (docNameFromHash(window.location.hash) === followTarget) return;
- window.location.assign(hashFromDocName(followTarget));
- }, [followFile, followTarget, turnActive, lastSeq]);
+ const currentDoc = docNameFromHash(window.location.hash);
+ const decision = decideFollowNavigation(followTarget, currentDoc, followNavRef.current);
+ followNavRef.current = decision.state;
+ if (decision.navigateTo !== null) {
+ window.location.assign(hashFromDocName(decision.navigateTo));
+ }
+ }, [active, followFile, followTarget, turnActive, lastSeq]);
const toggleFollow = (): void => {
const next = !followFile;
setFollowFile(next);
saveFollowFilePref(next);
- // Re-arm on re-enable so the current target is navigated to immediately.
+ // Re-enable = user explicitly wants follow back, no matter where they
+ // are. Full reset (`INITIAL_FOLLOW_NAV_STATE`) is correct here — unlike
+ // the turn-boundary re-arm, we want the current followTarget to
+ // navigate them immediately even if it matches a stale value, because
+ // the toggle-on IS the user's explicit intent to move.
if (next) {
- lastFollowedRef.current = null;
+ followNavRef.current = INITIAL_FOLLOW_NAV_STATE;
}
};
diff --git a/packages/app/src/components/acp/follow-file.test.ts b/packages/app/src/components/acp/follow-file.test.ts
index 1c0a0756b..944d80132 100644
--- a/packages/app/src/components/acp/follow-file.test.ts
+++ b/packages/app/src/components/acp/follow-file.test.ts
@@ -2,8 +2,11 @@ import { describe, expect, test } from 'vitest';
import type { RenderedToolCall } from '@/lib/acp/thread-event-model';
import type { Workspace } from '@/lib/workspace-paths';
import {
+ decideFollowNavigation,
docNameFromAbsolutePath,
+ type FollowNavState,
followTargetFromToolCall,
+ INITIAL_FOLLOW_NAV_STATE,
latestFollowTarget,
pageListFollowOptions,
} from './follow-file';
@@ -614,3 +617,171 @@ describe('pageListFollowOptions', () => {
expect(opts.docExists?.('')).toBe(false);
});
});
+
+describe('decideFollowNavigation', () => {
+ const initial: FollowNavState = INITIAL_FOLLOW_NAV_STATE;
+
+ test('no target → stay put, state unchanged', () => {
+ expect(decideFollowNavigation(null, 'reading/here', initial)).toEqual({
+ navigateTo: null,
+ state: initial,
+ });
+ });
+
+ test('first follow of a turn navigates and records the target', () => {
+ // Even when the reader is parked on another page: the first navigation of a
+ // turn is follow catching up to the agent (you launched it), not a yank.
+ expect(decideFollowNavigation('serafin', 'shagun-show-and-tell', initial)).toEqual({
+ navigateTo: 'serafin',
+ state: { lastFollowed: 'serafin', yielded: false, reArmed: false },
+ });
+ });
+
+ test('same target again → no re-navigation', () => {
+ const state: FollowNavState = { lastFollowed: 'serafin', yielded: false, reArmed: false };
+ expect(decideFollowNavigation('serafin', 'serafin', state)).toEqual({
+ navigateTo: null,
+ state,
+ });
+ });
+
+ test('agent moves to a new file while the reader stayed on track → follows along', () => {
+ // The editor is still where follow last put it (serafin) — the user has not
+ // taken control, so follow tracks the agent to its next file.
+ const state: FollowNavState = { lastFollowed: 'serafin', yielded: false, reArmed: false };
+ expect(decideFollowNavigation('orbit/plan', 'serafin', state)).toEqual({
+ navigateTo: 'orbit/plan',
+ state: { lastFollowed: 'orbit/plan', yielded: false, reArmed: false },
+ });
+ });
+
+ test('reader navigated off-track → yields, and stays yielded for later targets', () => {
+ // The reported bug: user reading shagun while the agent moves to serafin.
+ // The editor (shagun) is neither where follow last put them (serafin from an
+ // earlier write) nor the new target — so follow yields instead of yanking.
+ const state: FollowNavState = { lastFollowed: 'serafin', yielded: false, reArmed: false };
+ const first = decideFollowNavigation('orbit/plan', 'shagun-show-and-tell', state);
+ expect(first).toEqual({
+ navigateTo: null,
+ state: { lastFollowed: 'serafin', yielded: true, reArmed: false },
+ });
+ // A further agent write does not resume the yank — the latch holds. Full
+ // state assertion pins the invariant that `lastFollowed` stays on the
+ // last real anchor ('serafin') and doesn't drift to the yielded target;
+ // a refactor overwriting it would poison the next off-track comparison.
+ const second = decideFollowNavigation('orbit/deep', 'shagun-show-and-tell', first.state);
+ expect(second).toEqual({
+ navigateTo: null,
+ state: { lastFollowed: 'serafin', yielded: true, reArmed: false },
+ });
+ });
+
+ test('the user navigating to the exact new target is not treated as off-track', () => {
+ // They landed where follow wanted them anyway — record it (no navigation),
+ // and keep following so the next target still tracks.
+ const state: FollowNavState = { lastFollowed: 'serafin', yielded: false, reArmed: false };
+ const decision = decideFollowNavigation('orbit/plan', 'orbit/plan', state);
+ expect(decision).toEqual({
+ navigateTo: null,
+ state: { lastFollowed: 'orbit/plan', yielded: false, reArmed: false },
+ });
+ // Not yielded → the agent's next file still follows.
+ expect(decideFollowNavigation('orbit/next', 'orbit/plan', decision.state).navigateTo).toBe(
+ 'orbit/next',
+ );
+ });
+
+ test('an unknown current doc (null hash) on first follow still navigates', () => {
+ expect(decideFollowNavigation('serafin', null, initial)).toEqual({
+ navigateTo: 'serafin',
+ state: { lastFollowed: 'serafin', yielded: false, reArmed: false },
+ });
+ });
+
+ test('a null current hash after a prior follow still follows the next target', () => {
+ // Guard the `currentDoc !== null` sub-clause of the off-track predicate:
+ // an unknown hash (fresh mount, race between navigation and effect) must
+ // NOT count as "user is off-track" — treating unknown as missing would
+ // silently latch yielded mid-turn. Pinned so a refactor dropping the
+ // null-guard fires this test.
+ const state: FollowNavState = { lastFollowed: 'serafin', yielded: false, reArmed: false };
+ const decision = decideFollowNavigation('orbit/plan', null, state);
+ expect(decision).toEqual({
+ navigateTo: 'orbit/plan',
+ state: { lastFollowed: 'orbit/plan', yielded: false, reArmed: false },
+ });
+ });
+
+ test('a null current hash while yielded stays yielded (unknown hash does not un-latch)', () => {
+ // Companion to the null-hash-fresh-mount case above: when yield is
+ // already latched, an unknown hash must NOT reset it. A refactor that
+ // treated `currentDoc === null` as "safe to follow again" would resume
+ // driving navigation mid-turn even though the user had manually taken
+ // control and their prior yield is still in effect.
+ const state: FollowNavState = { lastFollowed: 'serafin', yielded: true, reArmed: false };
+ expect(decideFollowNavigation('orbit/plan', null, state)).toEqual({
+ navigateTo: null,
+ state, // unchanged — yielded stays latched.
+ });
+ });
+
+ test('user opening the agent target while yielded does not clear the yield latch', () => {
+ // The yielded guard runs BEFORE the currentDoc === followTarget branch
+ // — deliberately. A reader who latched a yield earlier this turn and
+ // then happens to open the agent's current file (via the omnibar or a
+ // link) is not signaling "resume follow"; they're still directing
+ // their own navigation. Pinned so a well-meaning reorder that lets
+ // the target-match branch fire first (silently un-latching yield)
+ // fails this test.
+ const state: FollowNavState = { lastFollowed: 'serafin', yielded: true, reArmed: false };
+ expect(decideFollowNavigation('orbit/plan', 'orbit/plan', state)).toEqual({
+ navigateTo: null,
+ state, // yielded stays latched; lastFollowed stays 'serafin'.
+ });
+ });
+
+ test('re-armed state (fresh cold turn) follows a new target from a parked reader', () => {
+ // Cold-start re-arm: no prior lastFollowed. `INITIAL_FOLLOW_NAV_STATE`
+ // carries `reArmed: false`, but still behaves like a re-armed turn
+ // because `lastFollowed === null` short-circuits off-track. Pins the
+ // golden path — launch a fresh agent, editor tracks its first write
+ // even if reader is on some unrelated doc.
+ expect(decideFollowNavigation('orbit/plan', 'shagun-show-and-tell', initial)).toEqual({
+ navigateTo: 'orbit/plan',
+ state: { lastFollowed: 'orbit/plan', yielded: false, reArmed: false },
+ });
+ });
+
+ test('turn boundary re-arm dedupes the stale followTarget (no yank to yesterday`s work)', () => {
+ // The regression pullfrog surfaced: `followTarget` is scanned from the
+ // accumulated event log and doesn't reset between turns, so a new turn
+ // begins with the PREVIOUS turn's last file as `followTarget`. If the
+ // re-arm zeroed `lastFollowed`, off-track would short-circuit false
+ // (lastFollowed=null), the re-armed navigation would fire, and the
+ // editor would yank to the stale target — no new agent work required.
+ // Preserving `lastFollowed` on re-arm makes the stale target dedupe
+ // via the `lastFollowed === followTarget` early return, and `reArmed`
+ // stays intact for the NEXT fresh target this turn.
+ const yielded: FollowNavState = { lastFollowed: 'serafin', yielded: true, reArmed: false };
+ // Turn boundary re-arm: yielded cleared, reArmed set, lastFollowed preserved.
+ const rearmed: FollowNavState = { ...yielded, yielded: false, reArmed: true };
+ const staleTick = decideFollowNavigation('serafin', 'shagun-show-and-tell', rearmed);
+ // Dedupe hit — no navigation to the stale target, state unchanged so
+ // the bypass survives for the next real target.
+ expect(staleTick).toEqual({ navigateTo: null, state: rearmed });
+ // Now the agent actually produces new work; the re-arm bypass fires and
+ // the user's new intent (they pressed send) wins over their prior yield.
+ const fresh = decideFollowNavigation('orbit/plan', 'shagun-show-and-tell', staleTick.state);
+ expect(fresh).toEqual({
+ navigateTo: 'orbit/plan',
+ state: { lastFollowed: 'orbit/plan', yielded: false, reArmed: false },
+ });
+ // reArmed is one-shot: a subsequent off-track target from the same turn
+ // yields, matching the pre-re-arm semantics inside a single turn.
+ const later = decideFollowNavigation('orbit/deep', 'shagun-show-and-tell', fresh.state);
+ expect(later).toEqual({
+ navigateTo: null,
+ state: { lastFollowed: 'orbit/plan', yielded: true, reArmed: false },
+ });
+ });
+});
diff --git a/packages/app/src/components/acp/follow-file.ts b/packages/app/src/components/acp/follow-file.ts
index 9316e0909..5093a50fb 100644
--- a/packages/app/src/components/acp/follow-file.ts
+++ b/packages/app/src/components/acp/follow-file.ts
@@ -277,6 +277,89 @@ export function followTargetFromToolCall(
return null;
}
+/**
+ * Follow-navigation state carried across a single agent turn.
+ *
+ * `lastFollowed` is the doc follow last drove the editor to (null until it has
+ * navigated at all). `yielded` latches once the user steps OFF that track —
+ * navigates the editor to a doc follow did not choose — after which follow
+ * stops driving navigation for the rest of the turn, so reading another page
+ * while an agent works elsewhere is never interrupted.
+ */
+export interface FollowNavState {
+ readonly lastFollowed: string | null;
+ readonly yielded: boolean;
+ /**
+ * A new turn just started; the NEXT off-track navigation is allowed
+ * through so the user's new intent ("send this message, track the
+ * work") beats the previous turn's yield latch. Cleared on the first
+ * real navigate.
+ *
+ * `lastFollowed` is preserved across turns — a stale `followTarget`
+ * left over from the previous turn deduplicates via
+ * `lastFollowed === followTarget` before the reArmed bypass fires. That
+ * dedupe is what keeps the re-arm from yanking the user to yesterday's
+ * work the instant they press send, on no new agent activity.
+ *
+ * Required (rather than optional) so the false vs undefined distinction
+ * disappears — a reader never has to wonder whether an absent field
+ * means "not re-armed" or "we forgot to set it".
+ */
+ readonly reArmed: boolean;
+}
+
+export const INITIAL_FOLLOW_NAV_STATE: FollowNavState = {
+ lastFollowed: null,
+ yielded: false,
+ reArmed: false,
+};
+
+/**
+ * Decide whether follow should drive the editor to `followTarget`, given where
+ * the editor currently is (`currentDoc`, the docName parsed from the location
+ * hash) and the state carried from the previous decision. Pure: returns the
+ * next state plus the docName to navigate to, or null to stay put.
+ *
+ * The yield rule is the fix for follow yanking a reader off their page: once
+ * the user navigates the editor to a doc that is neither where follow last put
+ * them nor where follow wants them next, they have taken manual control, so
+ * follow latches off until it is re-armed (a new turn, or the follow toggle).
+ * The first navigation of a turn (`lastFollowed === null`) is never treated as
+ * off-track — that is follow catching up to the agent, not the user leaving.
+ */
+export function decideFollowNavigation(
+ followTarget: string | null,
+ currentDoc: string | null,
+ state: FollowNavState,
+): { navigateTo: string | null; state: FollowNavState } {
+ if (followTarget === null) return { navigateTo: null, state };
+ // Already followed this exact target — nothing new to do. Preserved before
+ // the yield/off-track check so a stale target left over from the previous
+ // turn (followTarget is derived from the accumulated event log and only
+ // resets on log shrink) doesn't yank the user to yesterday's work the
+ // instant they start a new turn. Leaves `reArmed` intact so a subsequent
+ // FRESH target this turn still gets the bypass.
+ if (state.lastFollowed === followTarget) return { navigateTo: null, state };
+ const offTrack =
+ state.lastFollowed !== null &&
+ currentDoc !== null &&
+ currentDoc !== state.lastFollowed &&
+ currentDoc !== followTarget;
+ // A re-armed turn bypasses off-track for one fresh navigation — the user
+ // just directed the agent with a new prompt, so their prior yield preference
+ // is stale; the new work should follow. `yielded` alone is not enough to
+ // block: the whole point of re-arm is to clear it.
+ if (offTrack && !state.reArmed) {
+ return { navigateTo: null, state: { ...state, yielded: true } };
+ }
+ if (state.yielded && !state.reArmed) return { navigateTo: null, state };
+ const next: FollowNavState = { lastFollowed: followTarget, yielded: false, reArmed: false };
+ // The editor is already on the target (the user opened it, or follow put them
+ // there last tick) — record it so future targets dedupe, but don't re-navigate.
+ if (currentDoc === followTarget) return { navigateTo: null, state: next };
+ return { navigateTo: followTarget, state: next };
+}
+
/**
* The latest followable document across a transcript's items (last tool call
* with a resolvable target wins — that is what the agent touched most
diff --git a/packages/core/src/bridge/bind-frontmatter-doc.ts b/packages/core/src/bridge/bind-frontmatter-doc.ts
index 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.ts
index 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.ts
index 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/doc-boundary-space.ts b/packages/core/src/bridge/doc-boundary-space.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 0be5203e4..754dc5cc2 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;
@@ -128,7 +127,6 @@ 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(
@@ -250,7 +248,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.ts
index 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/markdown/callout-transformer.ts b/packages/core/src/markdown/callout-transformer.ts
index 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.ts
index 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.ts
index 34704165b..7415c474a 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 5d1000cc4..da0a81d23 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.ts
index 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): 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 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.ts
index 69221627d..9075aa7f1 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?: StructuralFreshnessChec
return 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.ts
index 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.ts
index 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.ts
index e413367ef..0ba33b7d8 100644
--- a/packages/core/src/markdown/lint/config-schemas.ts
+++ b/packages/core/src/markdown/lint/config-schemas.ts
@@ -38,7 +38,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.ts
index 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, 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 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.ts
index b96d19182..0d4c9a0df 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.ts
index 48d260ed6..00d08265a 100644
--- a/packages/core/src/markdown/lint/index.ts
+++ b/packages/core/src/markdown/lint/index.ts
@@ -1,4 +1,3 @@
-
import { LINT_PLUGINS, type LinterConfig } from './plugins.ts';
import type { LintDiagnostic } from './types.ts';
diff --git a/packages/core/src/markdown/lint/plugins.ts b/packages/core/src/markdown/lint/plugins.ts
index be5871ed9..5e832aa19 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 {
@@ -14,7 +13,6 @@ import {
type MarkdownlintSlice,
} from './types.ts';
-
const MarkdownlintRuleSettingSchema = z.union([
z.boolean(),
z.enum(MARKDOWNLINT_RULE_SEVERITIES),
diff --git a/packages/core/src/markdown/lint/types.ts b/packages/core/src/markdown/lint/types.ts
index 833c3a727..3918e657c 100644
--- a/packages/core/src/markdown/lint/types.ts
+++ b/packages/core/src/markdown/lint/types.ts
@@ -1,4 +1,3 @@
-
export const LINT_PLUGIN_IDS = ['markdownlint', 'frontmatter'] as const;
export type LintPluginId = (typeof LINT_PLUGIN_IDS)[number];
@@ -72,7 +71,6 @@ export interface FrontmatterSlice {
schemas: ResolvedFrontmatterSchemaEntry[];
}
-
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 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 5af2f05f5..449e6f12f 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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.ts
index 959cc0bd2..3e79f8cb6 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.ts
index 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.ts
index 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.ts
index 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.ts
index 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) {