markdown-it-directive
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -5,9 +5,12 @@ import DefaultMarkdownIt, {PluginSimple} from 'markdown-it'; | ||
export type DirectiveAttrs = Record<string, string>; | ||
export type DirectiveDests = ["link"|"string", string][]; | ||
interface InlineHandlerArgs { | ||
state: StateInline; | ||
content: string; | ||
dests: Record<string, string>[]; | ||
attrs: Record<string, string>[] | ||
contentStart: number; | ||
contentEnd: number; | ||
content: string | undefined; | ||
dests: DirectiveDests | undefined; | ||
attrs: DirectiveAttrs | undefined; | ||
contentStart: number | undefined; | ||
contentEnd: number | undefined; | ||
directiveStart: number; | ||
@@ -20,5 +23,5 @@ directiveEnd: number; | ||
contentTitle: string; | ||
inlineContent: string; | ||
dests: Record<string, string>[]; | ||
attrs: Record<string, string>[]; | ||
inlineContent: string | undefined; | ||
dests: DirectiveAttrs | undefined; | ||
attrs: DirectiveAttrs | undefined; | ||
contentStartLine?: number; | ||
@@ -28,4 +31,4 @@ contentEndLine?: number; | ||
contentTitleEnd: number; | ||
inlineContentStart: number; | ||
inlineContentEnd: number; | ||
inlineContentStart: number | undefined; | ||
inlineContentEnd: number | undefined; | ||
directiveStartLine: number; | ||
@@ -57,4 +60,4 @@ directiveEndLine: number; | ||
declare function load(): PluginSimple; | ||
declare const load: PluginSimple; | ||
export default load; |
11
index.js
'use strict'; | ||
const { normalizeReference } = require('markdown-it/lib/common/utils'); | ||
const StateInline = require('markdown-it/lib/rules_inline/state_inline'); | ||
function isBlank(code) { | ||
@@ -229,3 +226,3 @@ switch (code) { | ||
const refText = src.slice(destsStart + 1, destsEnd); | ||
const ref = state.env.references[normalizeReference(refText)]; | ||
const ref = state.env.references[md.utils.normalizeReference(refText)]; | ||
if (ref) { | ||
@@ -236,3 +233,3 @@ dests = [ [ 'link', ref.href ], [ 'string', ref.title ] ]; | ||
} else { | ||
const ref = state.env.references[normalizeReference(content)]; | ||
const ref = state.env.references[md.utils.normalizeReference(content)]; | ||
if (ref) { | ||
@@ -346,3 +343,3 @@ dests = [ [ 'link', ref.href ], [ 'string', ref.title ] ]; | ||
// which don't have a skipToken method | ||
const inlineState = new StateInline(src, md, state.env, []); | ||
const inlineState = new md.inline.State(src, md, state.env, []); | ||
const rst = parseDirective(inlineState, src, pos, max, true); | ||
@@ -417,3 +414,3 @@ if (rst === null) return false; | ||
function load(md, options) { | ||
function load(md) { | ||
if (md.inlineDirectives) return; | ||
@@ -420,0 +417,0 @@ |
{ | ||
"name": "markdown-it-directive", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Directive extension for markdown-it markdown parser.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,0 +0,0 @@ # markdown-it-directive |
@@ -0,0 +0,0 @@ # markdown-it-directive |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27416