diff --git a/src/source-map/build-source-map.ts b/src/source-map/build-source-map.ts index a6c7638..892575e 100644 --- a/src/source-map/build-source-map.ts +++ b/src/source-map/build-source-map.ts @@ -24,6 +24,7 @@ import type { MarkdownSourceMap, MarkdownSourceMapSegment, ParsedMarkdownDocument, + SourceSpan, } from './types'; // Use the exact same parser extensions as `parseMd` so the AST (and therefore @@ -292,11 +293,6 @@ function buildUrlSegments( return value === node.url ? { segments } : undefined; } -interface SourceSpan { - start: number - end: number -} - /** * Find the segment covering `valueIndex`, or undefined. * diff --git a/src/source-map/code-segments.ts b/src/source-map/code-segments.ts index 8a67221..74db072 100644 --- a/src/source-map/code-segments.ts +++ b/src/source-map/code-segments.ts @@ -1,16 +1,11 @@ import type { ParsedPosition } from '../types'; -import type { MarkdownSourceMapSegment } from './types'; +import type { MarkdownSourceMapSegment, SourceSpan } from './types'; interface CodeSegments { segments: MarkdownSourceMapSegment[] emptyOffset?: number } -interface SourceSpan { - start: number - end: number -} - function lineEnd(md: string, start: number, limit: number): number { let offset = start; while (offset < limit) { diff --git a/src/source-map/recording-extension.ts b/src/source-map/recording-extension.ts index e97fc07..e5edfeb 100644 --- a/src/source-map/recording-extension.ts +++ b/src/source-map/recording-extension.ts @@ -1,12 +1,7 @@ import { decodeNamedCharacterReference } from 'decode-named-character-reference'; import { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference'; import type { ParsedPoint } from '../types'; -import type { MarkdownSourceMapSegment } from './types'; - -interface SourceSpan { - start: number - end: number -} +import type { MarkdownSourceMapSegment, SourceSpan } from './types'; interface RecordingState { segments: WeakMap diff --git a/src/source-map/types.ts b/src/source-map/types.ts index 600bc3d..733a047 100644 --- a/src/source-map/types.ts +++ b/src/source-map/types.ts @@ -8,6 +8,16 @@ import type { ParsedPosition, } from '../types'; +/** + * An absolute half-open interval in the Markdown source. + * + * @internal + */ +export interface SourceSpan { + start: number + end: number +} + /** * The kind of transformation the parser applied to turn a slice of the raw * Markdown source into the corresponding slice of a node's normalized value.