mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-28 04:23:32 +01:00
💄
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import { MarkdownEngine } from '../markdownEngine';
|
||||
import { TableOfContents, TocEntry } from '../tableOfContentsProvider';
|
||||
import { TableOfContents, TocEntry } from '../tableOfContents';
|
||||
import { SkinnyTextDocument } from '../workspaceContents';
|
||||
|
||||
interface MarkdownSymbol {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import Token = require('markdown-it/lib/token');
|
||||
import * as vscode from 'vscode';
|
||||
import { MarkdownEngine } from '../markdownEngine';
|
||||
import { TableOfContents } from '../tableOfContentsProvider';
|
||||
import { TableOfContents } from '../tableOfContents';
|
||||
|
||||
const rangeLimit = 5000;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { dirname, resolve } from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import { MarkdownEngine } from '../markdownEngine';
|
||||
import { TableOfContents } from '../tableOfContentsProvider';
|
||||
import { TableOfContents } from '../tableOfContents';
|
||||
import { resolveUriToMarkdownFile } from '../util/openDocumentLink';
|
||||
import { MdLinkProvider } from './documentLinkProvider';
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import Token = require('markdown-it/lib/token');
|
||||
import * as vscode from 'vscode';
|
||||
import { MarkdownEngine } from '../markdownEngine';
|
||||
import { TableOfContents, TocEntry } from '../tableOfContentsProvider';
|
||||
import { TableOfContents, TocEntry } from '../tableOfContents';
|
||||
|
||||
interface MarkdownItTokenWithMap extends Token {
|
||||
map: [number, number];
|
||||
|
||||
@@ -45,15 +45,6 @@ export class TableOfContents {
|
||||
return this.create(engine, document);
|
||||
}
|
||||
|
||||
private constructor(
|
||||
public readonly entries: readonly TocEntry[],
|
||||
) { }
|
||||
|
||||
public lookup(fragment: string): TocEntry | undefined {
|
||||
const slug = githubSlugifier.fromHeading(fragment);
|
||||
return this.entries.find(entry => entry.slug.equals(slug));
|
||||
}
|
||||
|
||||
private static async buildToc(engine: MarkdownEngine, document: SkinnyTextDocument): Promise<TocEntry[]> {
|
||||
const toc: TocEntry[] = [];
|
||||
const tokens = await engine.parse(document);
|
||||
@@ -120,4 +111,13 @@ export class TableOfContents {
|
||||
private static getHeaderText(header: string): string {
|
||||
return header.replace(/^\s*#+\s*(.*?)(\s+#+)?$/, (_, word) => word.trim());
|
||||
}
|
||||
|
||||
private constructor(
|
||||
public readonly entries: readonly TocEntry[],
|
||||
) { }
|
||||
|
||||
public lookup(fragment: string): TocEntry | undefined {
|
||||
const slug = githubSlugifier.fromHeading(fragment);
|
||||
return this.entries.find(entry => entry.slug.equals(slug));
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
import * as assert from 'assert';
|
||||
import 'mocha';
|
||||
import * as vscode from 'vscode';
|
||||
import { TableOfContents } from '../tableOfContentsProvider';
|
||||
import { TableOfContents } from '../tableOfContents';
|
||||
import { createNewMarkdownEngine } from './engine';
|
||||
import { InMemoryDocument } from './inMemoryDocument';
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as path from 'path';
|
||||
import * as vscode from 'vscode';
|
||||
import * as uri from 'vscode-uri';
|
||||
import { MarkdownEngine } from '../markdownEngine';
|
||||
import { TableOfContents } from '../tableOfContentsProvider';
|
||||
import { TableOfContents } from '../tableOfContents';
|
||||
import { isMarkdownFile } from './file';
|
||||
|
||||
export interface OpenDocumentLinkArgs {
|
||||
|
||||
Reference in New Issue
Block a user