chrome-devtools-frontend 1.0.943709 → 1.0.945329
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/gni/devtools_grd_files.gni +3 -0
- package/front_end/core/common/ParsedURL.ts +1 -1
- package/front_end/core/host/UserMetrics.ts +2 -1
- package/front_end/core/i18n/i18nImpl.ts +7 -4
- package/front_end/core/i18n/locales/en-US.json +3 -72
- package/front_end/core/i18n/locales/en-XL.json +15 -84
- package/front_end/core/protocol_client/NodeURL.ts +1 -0
- package/front_end/core/sdk/CSSStyleDeclaration.ts +4 -0
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +2 -3
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +2 -3
- package/front_end/core/sdk/Cookie.ts +17 -0
- package/front_end/core/sdk/CookieModel.ts +1 -0
- package/front_end/core/sdk/DebuggerModel.ts +5 -4
- package/front_end/core/sdk/NetworkManager.ts +4 -1
- package/front_end/core/sdk/NetworkRequest.ts +2 -2
- package/front_end/core/sdk/OverlayModel.ts +0 -9
- package/front_end/core/sdk/Resource.ts +2 -2
- package/front_end/core/sdk/Script.ts +2 -7
- package/front_end/core/sdk/sdk-meta.ts +0 -26
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +0 -13
- package/front_end/entrypoints/main/MainImpl.ts +4 -0
- package/front_end/models/bindings/BreakpointManager.ts +3 -4
- package/front_end/models/bindings/DefaultScriptMapping.ts +1 -9
- package/front_end/models/bindings/ResourceMapping.ts +1 -2
- package/front_end/models/bindings/ResourceScriptMapping.ts +3 -11
- package/front_end/models/bindings/StylesSourceMapping.ts +1 -2
- package/front_end/models/formatter/SourceFormatter.ts +0 -15
- package/front_end/models/persistence/IsolatedFileSystem.ts +7 -6
- package/front_end/models/persistence/PersistenceActions.ts +4 -1
- package/front_end/models/persistence/PlatformFileSystem.ts +3 -4
- package/front_end/models/text_utils/ContentProvider.ts +1 -2
- package/front_end/models/text_utils/StaticContentProvider.ts +2 -3
- package/front_end/models/workspace/UISourceCode.ts +2 -2
- package/front_end/models/workspace_diff/WorkspaceDiff.ts +20 -6
- package/front_end/panels/animation/animationTimeline.css +2 -0
- package/front_end/panels/application/BackForwardCacheStrings.ts +15 -75
- package/front_end/panels/application/ReportingApiView.ts +15 -1
- package/front_end/panels/application/components/EndpointsGrid.ts +63 -4
- package/front_end/panels/application/components/FrameDetailsView.ts +21 -34
- package/front_end/panels/changes/ChangesView.ts +8 -7
- package/front_end/panels/console/ConsolePinPane.ts +1 -0
- package/front_end/panels/console/ConsolePrompt.ts +121 -171
- package/front_end/panels/console/ConsoleView.ts +1 -1
- package/front_end/panels/console/consoleView.css +1 -1
- package/front_end/panels/css_overview/cssOverviewCompletedView.css +2 -2
- package/front_end/panels/elements/AccessibilityTreeUtils.ts +98 -67
- package/front_end/panels/elements/AccessibilityTreeView.ts +76 -126
- package/front_end/panels/elements/ElementsPanel.ts +6 -7
- package/front_end/panels/elements/ElementsTreeElement.ts +1 -0
- package/front_end/panels/elements/StylePropertyHighlighter.ts +29 -19
- package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
- package/front_end/panels/elements/components/AccessibilityTreeNode.ts +27 -3
- package/front_end/panels/emulation/DeviceModeView.ts +3 -0
- package/front_end/panels/help/ReleaseNoteText.ts +3 -1
- package/front_end/panels/network/NetworkDataGridNode.ts +5 -1
- package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +1 -1
- package/front_end/panels/sources/BreakpointEditDialog.ts +1 -0
- package/front_end/panels/sources/DebuggerPlugin.ts +1 -1
- package/front_end/panels/sources/NavigatorView.ts +1 -1
- package/front_end/panels/sources/UISourceCodeFrame.ts +0 -1
- package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +3 -34
- package/front_end/panels/timeline/TimelineUIUtils.ts +51 -3
- package/front_end/services/window_bounds/WindowBoundsService.ts +27 -0
- package/front_end/services/window_bounds/window_bounds.ts +9 -0
- package/front_end/third_party/acorn/README.chromium +2 -2
- package/front_end/third_party/acorn/acorn.ts +1 -1
- package/front_end/third_party/acorn/package/CHANGELOG.md +31 -1
- package/front_end/third_party/acorn/package/README.md +1 -1
- package/front_end/third_party/acorn/package/dist/acorn.d.ts +3 -0
- package/front_end/third_party/acorn/package/dist/acorn.js +772 -708
- package/front_end/third_party/acorn/package/dist/acorn.mjs +767 -703
- package/front_end/third_party/acorn/package/dist/bin.js +47 -21
- package/front_end/third_party/acorn/package/package.json +1 -1
- package/front_end/third_party/acorn-loose/README.chromium +2 -2
- package/front_end/third_party/acorn-loose/package/CHANGELOG.md +12 -0
- package/front_end/third_party/acorn-loose/package/dist/acorn-loose.js +27 -7
- package/front_end/third_party/acorn-loose/package/dist/acorn-loose.mjs +28 -8
- package/front_end/third_party/acorn-loose/package/package.json +2 -2
- package/front_end/third_party/codemirror.next/bundle.ts +4 -3
- package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
- package/front_end/third_party/codemirror.next/codemirror.next.d.ts +39 -1
- package/front_end/third_party/codemirror.next/codemirror.next.js +1 -1
- package/front_end/third_party/codemirror.next/package.json +4 -4
- package/front_end/third_party/i18n/i18n-impl.ts +1 -1
- package/front_end/third_party/lit-html/README.chromium +2 -2
- package/front_end/third_party/lit-html/package/CHANGELOG.md +216 -28
- package/front_end/third_party/lit-html/package/LICENSE +9 -9
- package/front_end/third_party/lit-html/package/README.md +12 -162
- package/front_end/third_party/lit-html/package/async-directive.d.ts +23 -54
- package/front_end/third_party/lit-html/package/async-directive.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/async-directive.js +2 -7
- package/front_end/third_party/lit-html/package/async-directive.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/async-directive.d.ts +23 -54
- package/front_end/third_party/lit-html/package/development/async-directive.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/async-directive.js +44 -194
- package/front_end/third_party/lit-html/package/development/async-directive.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directive-helpers.d.ts +6 -5
- package/front_end/third_party/lit-html/package/development/directive-helpers.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directive-helpers.js +25 -9
- package/front_end/third_party/lit-html/package/development/directive-helpers.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directive.d.ts +3 -16
- package/front_end/third_party/lit-html/package/development/directive.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directive.js +6 -1
- package/front_end/third_party/lit-html/package/development/directive.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/async-append.d.ts +7 -14
- package/front_end/third_party/lit-html/package/development/directives/async-append.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/async-append.js +17 -58
- package/front_end/third_party/lit-html/package/development/directives/async-append.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/async-replace.d.ts +9 -14
- package/front_end/third_party/lit-html/package/development/directives/async-replace.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/async-replace.js +57 -37
- package/front_end/third_party/lit-html/package/development/directives/async-replace.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/cache.d.ts +2 -3
- package/front_end/third_party/lit-html/package/development/directives/cache.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/cache.js +4 -6
- package/front_end/third_party/lit-html/package/development/directives/cache.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/class-map.d.ts +2 -2
- package/front_end/third_party/lit-html/package/development/directives/class-map.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/class-map.js +17 -7
- package/front_end/third_party/lit-html/package/development/directives/class-map.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/guard.d.ts +3 -2
- package/front_end/third_party/lit-html/package/development/directives/guard.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/guard.js +3 -2
- package/front_end/third_party/lit-html/package/development/directives/guard.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/live.d.ts +4 -3
- package/front_end/third_party/lit-html/package/development/directives/live.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/live.js +5 -7
- package/front_end/third_party/lit-html/package/development/directives/live.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.d.ts +58 -0
- package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.d.ts.map +1 -0
- package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.js +85 -0
- package/front_end/third_party/lit-html/package/development/directives/private-async-helpers.js.map +1 -0
- package/front_end/third_party/lit-html/package/development/directives/ref.d.ts +14 -11
- package/front_end/third_party/lit-html/package/development/directives/ref.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/ref.js +13 -11
- package/front_end/third_party/lit-html/package/development/directives/ref.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/repeat.d.ts +8 -4
- package/front_end/third_party/lit-html/package/development/directives/repeat.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/repeat.js +23 -9
- package/front_end/third_party/lit-html/package/development/directives/repeat.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/style-map.d.ts +1 -2
- package/front_end/third_party/lit-html/package/development/directives/style-map.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/style-map.js +1 -2
- package/front_end/third_party/lit-html/package/development/directives/style-map.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/template-content.d.ts +1 -2
- package/front_end/third_party/lit-html/package/development/directives/template-content.js +1 -2
- package/front_end/third_party/lit-html/package/development/directives/unsafe-html.d.ts +6 -4
- package/front_end/third_party/lit-html/package/development/directives/unsafe-html.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/unsafe-html.js +7 -5
- package/front_end/third_party/lit-html/package/development/directives/unsafe-html.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.d.ts +4 -1
- package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.js +3 -0
- package/front_end/third_party/lit-html/package/development/directives/unsafe-svg.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/until.d.ts +12 -8
- package/front_end/third_party/lit-html/package/development/directives/until.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/directives/until.js +63 -23
- package/front_end/third_party/lit-html/package/development/directives/until.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/experimental-hydrate.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/experimental-hydrate.js +9 -8
- package/front_end/third_party/lit-html/package/development/experimental-hydrate.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/lit-html.d.ts +81 -136
- package/front_end/third_party/lit-html/package/development/lit-html.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/lit-html.js +249 -76
- package/front_end/third_party/lit-html/package/development/lit-html.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/polyfill-support.d.ts +1 -41
- package/front_end/third_party/lit-html/package/development/polyfill-support.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/polyfill-support.js +40 -21
- package/front_end/third_party/lit-html/package/development/polyfill-support.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/private-ssr-support.d.ts +12 -10
- package/front_end/third_party/lit-html/package/development/private-ssr-support.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/private-ssr-support.js +11 -3
- package/front_end/third_party/lit-html/package/development/private-ssr-support.js.map +1 -1
- package/front_end/third_party/lit-html/package/development/static.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/development/static.js +6 -5
- package/front_end/third_party/lit-html/package/development/static.js.map +1 -1
- package/front_end/third_party/lit-html/package/directive-helpers.d.ts +6 -5
- package/front_end/third_party/lit-html/package/directive-helpers.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directive-helpers.js +2 -2
- package/front_end/third_party/lit-html/package/directive-helpers.js.map +1 -1
- package/front_end/third_party/lit-html/package/directive.d.ts +3 -16
- package/front_end/third_party/lit-html/package/directive.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directive.js +1 -1
- package/front_end/third_party/lit-html/package/directive.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/async-append.d.ts +7 -14
- package/front_end/third_party/lit-html/package/directives/async-append.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/async-append.js +2 -6
- package/front_end/third_party/lit-html/package/directives/async-append.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/async-replace.d.ts +9 -14
- package/front_end/third_party/lit-html/package/directives/async-replace.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/async-replace.js +2 -5
- package/front_end/third_party/lit-html/package/directives/async-replace.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/cache.d.ts +2 -3
- package/front_end/third_party/lit-html/package/directives/cache.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/cache.js +2 -5
- package/front_end/third_party/lit-html/package/directives/cache.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/class-map.d.ts +2 -2
- package/front_end/third_party/lit-html/package/directives/class-map.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/class-map.js +2 -4
- package/front_end/third_party/lit-html/package/directives/class-map.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/guard.d.ts +3 -2
- package/front_end/third_party/lit-html/package/directives/guard.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/guard.js +2 -4
- package/front_end/third_party/lit-html/package/directives/guard.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/live.d.ts +4 -3
- package/front_end/third_party/lit-html/package/directives/live.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/live.js +1 -4
- package/front_end/third_party/lit-html/package/directives/live.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/private-async-helpers.d.ts +58 -0
- package/front_end/third_party/lit-html/package/directives/private-async-helpers.d.ts.map +1 -0
- package/front_end/third_party/lit-html/package/directives/private-async-helpers.js +7 -0
- package/front_end/third_party/lit-html/package/directives/private-async-helpers.js.map +1 -0
- package/front_end/third_party/lit-html/package/directives/ref.d.ts +14 -11
- package/front_end/third_party/lit-html/package/directives/ref.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/ref.js +2 -5
- package/front_end/third_party/lit-html/package/directives/ref.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/repeat.d.ts +8 -4
- package/front_end/third_party/lit-html/package/directives/repeat.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/repeat.js +2 -5
- package/front_end/third_party/lit-html/package/directives/repeat.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/style-map.d.ts +1 -2
- package/front_end/third_party/lit-html/package/directives/style-map.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/style-map.js +2 -4
- package/front_end/third_party/lit-html/package/directives/style-map.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/template-content.d.ts +1 -2
- package/front_end/third_party/lit-html/package/directives/template-content.js +2 -4
- package/front_end/third_party/lit-html/package/directives/template-content.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/unsafe-html.d.ts +6 -4
- package/front_end/third_party/lit-html/package/directives/unsafe-html.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/unsafe-html.js +2 -4
- package/front_end/third_party/lit-html/package/directives/unsafe-html.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/unsafe-svg.d.ts +4 -1
- package/front_end/third_party/lit-html/package/directives/unsafe-svg.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/unsafe-svg.js.map +1 -1
- package/front_end/third_party/lit-html/package/directives/until.d.ts +12 -8
- package/front_end/third_party/lit-html/package/directives/until.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/directives/until.js +2 -6
- package/front_end/third_party/lit-html/package/directives/until.js.map +1 -1
- package/front_end/third_party/lit-html/package/experimental-hydrate.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/experimental-hydrate.js +2 -5
- package/front_end/third_party/lit-html/package/experimental-hydrate.js.map +1 -1
- package/front_end/third_party/lit-html/package/lit-html.d.ts +81 -136
- package/front_end/third_party/lit-html/package/lit-html.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/lit-html.js +1 -1
- package/front_end/third_party/lit-html/package/lit-html.js.map +1 -1
- package/front_end/third_party/lit-html/package/package.json +75 -24
- package/front_end/third_party/lit-html/package/polyfill-support.d.ts +1 -41
- package/front_end/third_party/lit-html/package/polyfill-support.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/polyfill-support.js +1 -1
- package/front_end/third_party/lit-html/package/polyfill-support.js.map +1 -1
- package/front_end/third_party/lit-html/package/private-ssr-support.d.ts +12 -10
- package/front_end/third_party/lit-html/package/private-ssr-support.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/private-ssr-support.js +2 -2
- package/front_end/third_party/lit-html/package/private-ssr-support.js.map +1 -1
- package/front_end/third_party/lit-html/package/static.d.ts.map +1 -1
- package/front_end/third_party/lit-html/package/static.js +1 -1
- package/front_end/third_party/lit-html/package/static.js.map +1 -1
- package/front_end/third_party/marked/README.chromium +2 -2
- package/front_end/third_party/marked/marked.ts +2 -2
- package/front_end/third_party/marked/package/README.md +7 -1
- package/front_end/third_party/marked/package/bin/marked.js +214 -0
- package/front_end/third_party/marked/package/lib/marked.cjs +2907 -0
- package/front_end/third_party/marked/package/lib/marked.esm.d.ts +1 -3
- package/front_end/third_party/marked/package/lib/marked.esm.js +627 -586
- package/front_end/third_party/marked/package/lib/marked.umd.js +2913 -0
- package/front_end/third_party/marked/package/man/marked.1 +5 -24
- package/front_end/third_party/marked/package/man/marked.1.txt +21 -31
- package/front_end/third_party/marked/package/marked.min.js +1 -1
- package/front_end/third_party/marked/package/package.json +41 -32
- package/front_end/third_party/marked/package/src/Lexer.js +109 -108
- package/front_end/third_party/marked/package/src/Parser.js +38 -15
- package/front_end/third_party/marked/package/src/Renderer.js +5 -5
- package/front_end/third_party/marked/package/src/Slugger.js +2 -2
- package/front_end/third_party/marked/package/src/TextRenderer.js +2 -2
- package/front_end/third_party/marked/package/src/Tokenizer.js +215 -190
- package/front_end/third_party/marked/package/src/defaults.js +6 -9
- package/front_end/third_party/marked/package/src/helpers.js +16 -27
- package/front_end/third_party/marked/package/src/marked.js +146 -63
- package/front_end/third_party/marked/package/src/rules.js +20 -45
- package/front_end/third_party/wasmparser/README.chromium +2 -2
- package/front_end/third_party/wasmparser/package/.github/workflows/main.yml +47 -0
- package/front_end/third_party/wasmparser/package/CHANGELOG.md +12 -0
- package/front_end/third_party/wasmparser/package/dist/cjs/WasmParser.js +53 -53
- package/front_end/third_party/wasmparser/package/dist/cjs/WasmParser.js.map +1 -1
- package/front_end/third_party/wasmparser/package/dist/esm/WasmParser.js +53 -53
- package/front_end/third_party/wasmparser/package/dist/esm/WasmParser.js.map +1 -1
- package/front_end/third_party/wasmparser/package/package.json +1 -1
- package/front_end/third_party/wasmparser/package/src/WasmParser.ts +53 -53
- package/front_end/ui/components/text_editor/TextEditor.ts +29 -0
- package/front_end/ui/components/text_editor/config.ts +36 -14
- package/front_end/ui/components/text_editor/javascript.ts +14 -9
- package/front_end/ui/components/text_editor/theme.ts +29 -4
- package/front_end/ui/legacy/InspectorView.ts +1 -1
- package/front_end/ui/legacy/ViewManager.ts +6 -0
- package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +20 -0
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +1 -0
- package/front_end/ui/legacy/components/utils/Linkifier.ts +49 -79
- package/front_end/ui/legacy/themeColors.css +2 -0
- package/inspector_overlay/main.ts +3 -0
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { defaults } from './defaults.js';
|
|
2
|
+
import { Tokenizer } from './Tokenizer.js';
|
|
3
|
+
|
|
4
|
+
import { block, inline } from './rules.js';
|
|
5
|
+
import { repeatString } from './helpers.js';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* smartypants text replacement
|
|
@@ -47,7 +48,7 @@ function mangle(text) {
|
|
|
47
48
|
/**
|
|
48
49
|
* Block Lexer
|
|
49
50
|
*/
|
|
50
|
-
|
|
51
|
+
export class Lexer {
|
|
51
52
|
constructor(options) {
|
|
52
53
|
this.tokens = [];
|
|
53
54
|
this.tokens.links = Object.create(null);
|
|
@@ -55,6 +56,13 @@ module.exports = class Lexer {
|
|
|
55
56
|
this.options.tokenizer = this.options.tokenizer || new Tokenizer();
|
|
56
57
|
this.tokenizer = this.options.tokenizer;
|
|
57
58
|
this.tokenizer.options = this.options;
|
|
59
|
+
this.tokenizer.lexer = this;
|
|
60
|
+
this.inlineQueue = [];
|
|
61
|
+
this.state = {
|
|
62
|
+
inLink: false,
|
|
63
|
+
inRawBlock: false,
|
|
64
|
+
top: true
|
|
65
|
+
};
|
|
58
66
|
|
|
59
67
|
const rules = {
|
|
60
68
|
block: block.normal,
|
|
@@ -109,9 +117,12 @@ module.exports = class Lexer {
|
|
|
109
117
|
.replace(/\r\n|\r/g, '\n')
|
|
110
118
|
.replace(/\t/g, ' ');
|
|
111
119
|
|
|
112
|
-
this.blockTokens(src, this.tokens
|
|
120
|
+
this.blockTokens(src, this.tokens);
|
|
113
121
|
|
|
114
|
-
|
|
122
|
+
let next;
|
|
123
|
+
while (next = this.inlineQueue.shift()) {
|
|
124
|
+
this.inlineTokens(next.src, next.tokens);
|
|
125
|
+
}
|
|
115
126
|
|
|
116
127
|
return this.tokens;
|
|
117
128
|
}
|
|
@@ -119,13 +130,26 @@ module.exports = class Lexer {
|
|
|
119
130
|
/**
|
|
120
131
|
* Lexing
|
|
121
132
|
*/
|
|
122
|
-
blockTokens(src, tokens = []
|
|
133
|
+
blockTokens(src, tokens = []) {
|
|
123
134
|
if (this.options.pedantic) {
|
|
124
135
|
src = src.replace(/^ +$/gm, '');
|
|
125
136
|
}
|
|
126
|
-
let token,
|
|
137
|
+
let token, lastToken, cutSrc, lastParagraphClipped;
|
|
127
138
|
|
|
128
139
|
while (src) {
|
|
140
|
+
if (this.options.extensions
|
|
141
|
+
&& this.options.extensions.block
|
|
142
|
+
&& this.options.extensions.block.some((extTokenizer) => {
|
|
143
|
+
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
144
|
+
src = src.substring(token.raw.length);
|
|
145
|
+
tokens.push(token);
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
return false;
|
|
149
|
+
})) {
|
|
150
|
+
continue;
|
|
151
|
+
}
|
|
152
|
+
|
|
129
153
|
// newline
|
|
130
154
|
if (token = this.tokenizer.space(src)) {
|
|
131
155
|
src = src.substring(token.raw.length);
|
|
@@ -140,9 +164,10 @@ module.exports = class Lexer {
|
|
|
140
164
|
src = src.substring(token.raw.length);
|
|
141
165
|
lastToken = tokens[tokens.length - 1];
|
|
142
166
|
// An indented code block cannot interrupt a paragraph.
|
|
143
|
-
if (lastToken && lastToken.type === 'paragraph') {
|
|
167
|
+
if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
|
|
144
168
|
lastToken.raw += '\n' + token.raw;
|
|
145
169
|
lastToken.text += '\n' + token.text;
|
|
170
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
146
171
|
} else {
|
|
147
172
|
tokens.push(token);
|
|
148
173
|
}
|
|
@@ -163,13 +188,6 @@ module.exports = class Lexer {
|
|
|
163
188
|
continue;
|
|
164
189
|
}
|
|
165
190
|
|
|
166
|
-
// table no leading pipe (gfm)
|
|
167
|
-
if (token = this.tokenizer.nptable(src)) {
|
|
168
|
-
src = src.substring(token.raw.length);
|
|
169
|
-
tokens.push(token);
|
|
170
|
-
continue;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
191
|
// hr
|
|
174
192
|
if (token = this.tokenizer.hr(src)) {
|
|
175
193
|
src = src.substring(token.raw.length);
|
|
@@ -180,7 +198,6 @@ module.exports = class Lexer {
|
|
|
180
198
|
// blockquote
|
|
181
199
|
if (token = this.tokenizer.blockquote(src)) {
|
|
182
200
|
src = src.substring(token.raw.length);
|
|
183
|
-
token.tokens = this.blockTokens(token.text, [], top);
|
|
184
201
|
tokens.push(token);
|
|
185
202
|
continue;
|
|
186
203
|
}
|
|
@@ -188,10 +205,6 @@ module.exports = class Lexer {
|
|
|
188
205
|
// list
|
|
189
206
|
if (token = this.tokenizer.list(src)) {
|
|
190
207
|
src = src.substring(token.raw.length);
|
|
191
|
-
l = token.items.length;
|
|
192
|
-
for (i = 0; i < l; i++) {
|
|
193
|
-
token.items[i].tokens = this.blockTokens(token.items[i].text, [], false);
|
|
194
|
-
}
|
|
195
208
|
tokens.push(token);
|
|
196
209
|
continue;
|
|
197
210
|
}
|
|
@@ -204,9 +217,14 @@ module.exports = class Lexer {
|
|
|
204
217
|
}
|
|
205
218
|
|
|
206
219
|
// def
|
|
207
|
-
if (
|
|
220
|
+
if (token = this.tokenizer.def(src)) {
|
|
208
221
|
src = src.substring(token.raw.length);
|
|
209
|
-
|
|
222
|
+
lastToken = tokens[tokens.length - 1];
|
|
223
|
+
if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
|
|
224
|
+
lastToken.raw += '\n' + token.raw;
|
|
225
|
+
lastToken.text += '\n' + token.raw;
|
|
226
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
227
|
+
} else if (!this.tokens.links[token.tag]) {
|
|
210
228
|
this.tokens.links[token.tag] = {
|
|
211
229
|
href: token.href,
|
|
212
230
|
title: token.title
|
|
@@ -230,9 +248,32 @@ module.exports = class Lexer {
|
|
|
230
248
|
}
|
|
231
249
|
|
|
232
250
|
// top-level paragraph
|
|
233
|
-
|
|
251
|
+
// prevent paragraph consuming extensions by clipping 'src' to extension start
|
|
252
|
+
cutSrc = src;
|
|
253
|
+
if (this.options.extensions && this.options.extensions.startBlock) {
|
|
254
|
+
let startIndex = Infinity;
|
|
255
|
+
const tempSrc = src.slice(1);
|
|
256
|
+
let tempStart;
|
|
257
|
+
this.options.extensions.startBlock.forEach(function(getStartIndex) {
|
|
258
|
+
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
|
259
|
+
if (typeof tempStart === 'number' && tempStart >= 0) { startIndex = Math.min(startIndex, tempStart); }
|
|
260
|
+
});
|
|
261
|
+
if (startIndex < Infinity && startIndex >= 0) {
|
|
262
|
+
cutSrc = src.substring(0, startIndex + 1);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
|
|
266
|
+
lastToken = tokens[tokens.length - 1];
|
|
267
|
+
if (lastParagraphClipped && lastToken.type === 'paragraph') {
|
|
268
|
+
lastToken.raw += '\n' + token.raw;
|
|
269
|
+
lastToken.text += '\n' + token.text;
|
|
270
|
+
this.inlineQueue.pop();
|
|
271
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
272
|
+
} else {
|
|
273
|
+
tokens.push(token);
|
|
274
|
+
}
|
|
275
|
+
lastParagraphClipped = (cutSrc.length !== src.length);
|
|
234
276
|
src = src.substring(token.raw.length);
|
|
235
|
-
tokens.push(token);
|
|
236
277
|
continue;
|
|
237
278
|
}
|
|
238
279
|
|
|
@@ -243,6 +284,8 @@ module.exports = class Lexer {
|
|
|
243
284
|
if (lastToken && lastToken.type === 'text') {
|
|
244
285
|
lastToken.raw += '\n' + token.raw;
|
|
245
286
|
lastToken.text += '\n' + token.text;
|
|
287
|
+
this.inlineQueue.pop();
|
|
288
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
|
246
289
|
} else {
|
|
247
290
|
tokens.push(token);
|
|
248
291
|
}
|
|
@@ -260,79 +303,19 @@ module.exports = class Lexer {
|
|
|
260
303
|
}
|
|
261
304
|
}
|
|
262
305
|
|
|
306
|
+
this.state.top = true;
|
|
263
307
|
return tokens;
|
|
264
308
|
}
|
|
265
309
|
|
|
266
|
-
inline(tokens) {
|
|
267
|
-
|
|
268
|
-
j,
|
|
269
|
-
k,
|
|
270
|
-
l2,
|
|
271
|
-
row,
|
|
272
|
-
token;
|
|
273
|
-
|
|
274
|
-
const l = tokens.length;
|
|
275
|
-
for (i = 0; i < l; i++) {
|
|
276
|
-
token = tokens[i];
|
|
277
|
-
switch (token.type) {
|
|
278
|
-
case 'paragraph':
|
|
279
|
-
case 'text':
|
|
280
|
-
case 'heading': {
|
|
281
|
-
token.tokens = [];
|
|
282
|
-
this.inlineTokens(token.text, token.tokens);
|
|
283
|
-
break;
|
|
284
|
-
}
|
|
285
|
-
case 'table': {
|
|
286
|
-
token.tokens = {
|
|
287
|
-
header: [],
|
|
288
|
-
cells: []
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
// header
|
|
292
|
-
l2 = token.header.length;
|
|
293
|
-
for (j = 0; j < l2; j++) {
|
|
294
|
-
token.tokens.header[j] = [];
|
|
295
|
-
this.inlineTokens(token.header[j], token.tokens.header[j]);
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
// cells
|
|
299
|
-
l2 = token.cells.length;
|
|
300
|
-
for (j = 0; j < l2; j++) {
|
|
301
|
-
row = token.cells[j];
|
|
302
|
-
token.tokens.cells[j] = [];
|
|
303
|
-
for (k = 0; k < row.length; k++) {
|
|
304
|
-
token.tokens.cells[j][k] = [];
|
|
305
|
-
this.inlineTokens(row[k], token.tokens.cells[j][k]);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
break;
|
|
310
|
-
}
|
|
311
|
-
case 'blockquote': {
|
|
312
|
-
this.inline(token.tokens);
|
|
313
|
-
break;
|
|
314
|
-
}
|
|
315
|
-
case 'list': {
|
|
316
|
-
l2 = token.items.length;
|
|
317
|
-
for (j = 0; j < l2; j++) {
|
|
318
|
-
this.inline(token.items[j].tokens);
|
|
319
|
-
}
|
|
320
|
-
break;
|
|
321
|
-
}
|
|
322
|
-
default: {
|
|
323
|
-
// do nothing
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
return tokens;
|
|
310
|
+
inline(src, tokens) {
|
|
311
|
+
this.inlineQueue.push({ src, tokens });
|
|
329
312
|
}
|
|
330
313
|
|
|
331
314
|
/**
|
|
332
315
|
* Lexing/Compiling
|
|
333
316
|
*/
|
|
334
|
-
inlineTokens(src, tokens = []
|
|
335
|
-
let token, lastToken;
|
|
317
|
+
inlineTokens(src, tokens = []) {
|
|
318
|
+
let token, lastToken, cutSrc;
|
|
336
319
|
|
|
337
320
|
// String with links masked to avoid interference with em and strong
|
|
338
321
|
let maskedSrc = src;
|
|
@@ -366,6 +349,20 @@ module.exports = class Lexer {
|
|
|
366
349
|
}
|
|
367
350
|
keepPrevChar = false;
|
|
368
351
|
|
|
352
|
+
// extensions
|
|
353
|
+
if (this.options.extensions
|
|
354
|
+
&& this.options.extensions.inline
|
|
355
|
+
&& this.options.extensions.inline.some((extTokenizer) => {
|
|
356
|
+
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
|
357
|
+
src = src.substring(token.raw.length);
|
|
358
|
+
tokens.push(token);
|
|
359
|
+
return true;
|
|
360
|
+
}
|
|
361
|
+
return false;
|
|
362
|
+
})) {
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
|
|
369
366
|
// escape
|
|
370
367
|
if (token = this.tokenizer.escape(src)) {
|
|
371
368
|
src = src.substring(token.raw.length);
|
|
@@ -374,11 +371,9 @@ module.exports = class Lexer {
|
|
|
374
371
|
}
|
|
375
372
|
|
|
376
373
|
// tag
|
|
377
|
-
if (token = this.tokenizer.tag(src
|
|
374
|
+
if (token = this.tokenizer.tag(src)) {
|
|
378
375
|
src = src.substring(token.raw.length);
|
|
379
|
-
|
|
380
|
-
inRawBlock = token.inRawBlock;
|
|
381
|
-
const lastToken = tokens[tokens.length - 1];
|
|
376
|
+
lastToken = tokens[tokens.length - 1];
|
|
382
377
|
if (lastToken && token.type === 'text' && lastToken.type === 'text') {
|
|
383
378
|
lastToken.raw += token.raw;
|
|
384
379
|
lastToken.text += token.text;
|
|
@@ -391,9 +386,6 @@ module.exports = class Lexer {
|
|
|
391
386
|
// link
|
|
392
387
|
if (token = this.tokenizer.link(src)) {
|
|
393
388
|
src = src.substring(token.raw.length);
|
|
394
|
-
if (token.type === 'link') {
|
|
395
|
-
token.tokens = this.inlineTokens(token.text, [], true, inRawBlock);
|
|
396
|
-
}
|
|
397
389
|
tokens.push(token);
|
|
398
390
|
continue;
|
|
399
391
|
}
|
|
@@ -401,11 +393,8 @@ module.exports = class Lexer {
|
|
|
401
393
|
// reflink, nolink
|
|
402
394
|
if (token = this.tokenizer.reflink(src, this.tokens.links)) {
|
|
403
395
|
src = src.substring(token.raw.length);
|
|
404
|
-
|
|
405
|
-
if (token.type === '
|
|
406
|
-
token.tokens = this.inlineTokens(token.text, [], true, inRawBlock);
|
|
407
|
-
tokens.push(token);
|
|
408
|
-
} else if (lastToken && token.type === 'text' && lastToken.type === 'text') {
|
|
396
|
+
lastToken = tokens[tokens.length - 1];
|
|
397
|
+
if (lastToken && token.type === 'text' && lastToken.type === 'text') {
|
|
409
398
|
lastToken.raw += token.raw;
|
|
410
399
|
lastToken.text += token.text;
|
|
411
400
|
} else {
|
|
@@ -417,7 +406,6 @@ module.exports = class Lexer {
|
|
|
417
406
|
// em & strong
|
|
418
407
|
if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
|
|
419
408
|
src = src.substring(token.raw.length);
|
|
420
|
-
token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
|
|
421
409
|
tokens.push(token);
|
|
422
410
|
continue;
|
|
423
411
|
}
|
|
@@ -439,7 +427,6 @@ module.exports = class Lexer {
|
|
|
439
427
|
// del (gfm)
|
|
440
428
|
if (token = this.tokenizer.del(src)) {
|
|
441
429
|
src = src.substring(token.raw.length);
|
|
442
|
-
token.tokens = this.inlineTokens(token.text, [], inLink, inRawBlock);
|
|
443
430
|
tokens.push(token);
|
|
444
431
|
continue;
|
|
445
432
|
}
|
|
@@ -452,14 +439,28 @@ module.exports = class Lexer {
|
|
|
452
439
|
}
|
|
453
440
|
|
|
454
441
|
// url (gfm)
|
|
455
|
-
if (!inLink && (token = this.tokenizer.url(src, mangle))) {
|
|
442
|
+
if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
|
|
456
443
|
src = src.substring(token.raw.length);
|
|
457
444
|
tokens.push(token);
|
|
458
445
|
continue;
|
|
459
446
|
}
|
|
460
447
|
|
|
461
448
|
// text
|
|
462
|
-
|
|
449
|
+
// prevent inlineText consuming extensions by clipping 'src' to extension start
|
|
450
|
+
cutSrc = src;
|
|
451
|
+
if (this.options.extensions && this.options.extensions.startInline) {
|
|
452
|
+
let startIndex = Infinity;
|
|
453
|
+
const tempSrc = src.slice(1);
|
|
454
|
+
let tempStart;
|
|
455
|
+
this.options.extensions.startInline.forEach(function(getStartIndex) {
|
|
456
|
+
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
|
457
|
+
if (typeof tempStart === 'number' && tempStart >= 0) { startIndex = Math.min(startIndex, tempStart); }
|
|
458
|
+
});
|
|
459
|
+
if (startIndex < Infinity && startIndex >= 0) {
|
|
460
|
+
cutSrc = src.substring(0, startIndex + 1);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
|
|
463
464
|
src = src.substring(token.raw.length);
|
|
464
465
|
if (token.raw.slice(-1) !== '_') { // Track prevChar before string of ____ started
|
|
465
466
|
prevChar = token.raw.slice(-1);
|
|
@@ -488,4 +489,4 @@ module.exports = class Lexer {
|
|
|
488
489
|
|
|
489
490
|
return tokens;
|
|
490
491
|
}
|
|
491
|
-
}
|
|
492
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const Slugger = require('./Slugger.js');
|
|
4
|
-
const { defaults } = require('./defaults.js');
|
|
5
|
-
const {
|
|
1
|
+
import { defaults } from './defaults.js';
|
|
2
|
+
import {
|
|
6
3
|
unescape
|
|
7
|
-
}
|
|
4
|
+
} from './helpers.js';
|
|
5
|
+
import { Renderer } from './Renderer.js';
|
|
6
|
+
import { Slugger } from './Slugger.js';
|
|
7
|
+
import { TextRenderer } from './TextRenderer.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Parsing & Compiling
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
export class Parser {
|
|
13
13
|
constructor(options) {
|
|
14
14
|
this.options = options || defaults;
|
|
15
15
|
this.options.renderer = this.options.renderer || new Renderer();
|
|
@@ -57,11 +57,22 @@ module.exports = class Parser {
|
|
|
57
57
|
item,
|
|
58
58
|
checked,
|
|
59
59
|
task,
|
|
60
|
-
checkbox
|
|
60
|
+
checkbox,
|
|
61
|
+
ret;
|
|
61
62
|
|
|
62
63
|
const l = tokens.length;
|
|
63
64
|
for (i = 0; i < l; i++) {
|
|
64
65
|
token = tokens[i];
|
|
66
|
+
|
|
67
|
+
// Run any renderer extensions
|
|
68
|
+
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
|
|
69
|
+
ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
|
|
70
|
+
if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(token.type)) {
|
|
71
|
+
out += ret || '';
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
65
76
|
switch (token.type) {
|
|
66
77
|
case 'space': {
|
|
67
78
|
continue;
|
|
@@ -92,22 +103,22 @@ module.exports = class Parser {
|
|
|
92
103
|
l2 = token.header.length;
|
|
93
104
|
for (j = 0; j < l2; j++) {
|
|
94
105
|
cell += this.renderer.tablecell(
|
|
95
|
-
this.parseInline(token.
|
|
106
|
+
this.parseInline(token.header[j].tokens),
|
|
96
107
|
{ header: true, align: token.align[j] }
|
|
97
108
|
);
|
|
98
109
|
}
|
|
99
110
|
header += this.renderer.tablerow(cell);
|
|
100
111
|
|
|
101
112
|
body = '';
|
|
102
|
-
l2 = token.
|
|
113
|
+
l2 = token.rows.length;
|
|
103
114
|
for (j = 0; j < l2; j++) {
|
|
104
|
-
row = token.
|
|
115
|
+
row = token.rows[j];
|
|
105
116
|
|
|
106
117
|
cell = '';
|
|
107
118
|
l3 = row.length;
|
|
108
119
|
for (k = 0; k < l3; k++) {
|
|
109
120
|
cell += this.renderer.tablecell(
|
|
110
|
-
this.parseInline(row[k]),
|
|
121
|
+
this.parseInline(row[k].tokens),
|
|
111
122
|
{ header: false, align: token.align[k] }
|
|
112
123
|
);
|
|
113
124
|
}
|
|
@@ -138,7 +149,7 @@ module.exports = class Parser {
|
|
|
138
149
|
if (item.task) {
|
|
139
150
|
checkbox = this.renderer.checkbox(checked);
|
|
140
151
|
if (loose) {
|
|
141
|
-
if (item.tokens.length > 0 && item.tokens[0].type === '
|
|
152
|
+
if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
|
|
142
153
|
item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
|
|
143
154
|
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
|
|
144
155
|
item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
|
|
@@ -179,6 +190,7 @@ module.exports = class Parser {
|
|
|
179
190
|
out += top ? this.renderer.paragraph(body) : body;
|
|
180
191
|
continue;
|
|
181
192
|
}
|
|
193
|
+
|
|
182
194
|
default: {
|
|
183
195
|
const errMsg = 'Token with "' + token.type + '" type was not found.';
|
|
184
196
|
if (this.options.silent) {
|
|
@@ -201,11 +213,22 @@ module.exports = class Parser {
|
|
|
201
213
|
renderer = renderer || this.renderer;
|
|
202
214
|
let out = '',
|
|
203
215
|
i,
|
|
204
|
-
token
|
|
216
|
+
token,
|
|
217
|
+
ret;
|
|
205
218
|
|
|
206
219
|
const l = tokens.length;
|
|
207
220
|
for (i = 0; i < l; i++) {
|
|
208
221
|
token = tokens[i];
|
|
222
|
+
|
|
223
|
+
// Run any renderer extensions
|
|
224
|
+
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
|
|
225
|
+
ret = this.options.extensions.renderers[token.type].call({ parser: this }, token);
|
|
226
|
+
if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(token.type)) {
|
|
227
|
+
out += ret || '';
|
|
228
|
+
continue;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
209
232
|
switch (token.type) {
|
|
210
233
|
case 'escape': {
|
|
211
234
|
out += renderer.text(token.text);
|
|
@@ -260,4 +283,4 @@ module.exports = class Parser {
|
|
|
260
283
|
}
|
|
261
284
|
return out;
|
|
262
285
|
}
|
|
263
|
-
}
|
|
286
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { defaults } from './defaults.js';
|
|
2
|
+
import {
|
|
3
3
|
cleanUrl,
|
|
4
4
|
escape
|
|
5
|
-
}
|
|
5
|
+
} from './helpers.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Renderer
|
|
9
9
|
*/
|
|
10
|
-
|
|
10
|
+
export class Renderer {
|
|
11
11
|
constructor(options) {
|
|
12
12
|
this.options = options || defaults;
|
|
13
13
|
}
|
|
@@ -163,4 +163,4 @@ module.exports = class Renderer {
|
|
|
163
163
|
text(text) {
|
|
164
164
|
return text;
|
|
165
165
|
}
|
|
166
|
-
}
|
|
166
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Slugger generates header id
|
|
3
3
|
*/
|
|
4
|
-
|
|
4
|
+
export class Slugger {
|
|
5
5
|
constructor() {
|
|
6
6
|
this.seen = {};
|
|
7
7
|
}
|
|
@@ -46,4 +46,4 @@ module.exports = class Slugger {
|
|
|
46
46
|
const slug = this.serialize(value);
|
|
47
47
|
return this.getNextSafeSlug(slug, options.dryrun);
|
|
48
48
|
}
|
|
49
|
-
}
|
|
49
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* TextRenderer
|
|
3
3
|
* returns only the textual part of the token
|
|
4
4
|
*/
|
|
5
|
-
|
|
5
|
+
export class TextRenderer {
|
|
6
6
|
// no need for block level renderers
|
|
7
7
|
strong(text) {
|
|
8
8
|
return text;
|
|
@@ -39,4 +39,4 @@ module.exports = class TextRenderer {
|
|
|
39
39
|
br() {
|
|
40
40
|
return '';
|
|
41
41
|
}
|
|
42
|
-
}
|
|
42
|
+
}
|