Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/source-map/build-source-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
*
Expand Down
7 changes: 1 addition & 6 deletions src/source-map/code-segments.ts
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down
7 changes: 1 addition & 6 deletions src/source-map/recording-extension.ts
Original file line number Diff line number Diff line change
@@ -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<object, MarkdownSourceMapSegment[]>
Expand Down
10 changes: 10 additions & 0 deletions src/source-map/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down