mdast-util-to-markdown
Advanced tools
Comparing version 1.2.3 to 1.2.4
@@ -1,6 +0,3 @@ | ||
/** | ||
* @typedef {import('./types.js').Unsafe} Unsafe | ||
*/ | ||
/** @type {Array.<Unsafe>} */ | ||
export const unsafe: Array<Unsafe> | ||
export type Unsafe = import('./types.js').Unsafe |
@@ -5,2 +5,17 @@ /** | ||
/** | ||
* List of constructs that occur in phrasing (paragraphs, headings), but cannot | ||
* contain things like attention (emphasis, strong), images, or links. | ||
* So they sort of cancel each other out. | ||
* Note: could use a better name. | ||
*/ | ||
const fullPhrasingSpans = [ | ||
'autolink', | ||
'destinationLiteral', | ||
'destinationRaw', | ||
'reference', | ||
'titleQuote', | ||
'titleApostrophe' | ||
] | ||
/** @type {Array.<Unsafe>} */ | ||
@@ -44,3 +59,8 @@ export const unsafe = [ | ||
// a link reference. | ||
{character: '!', after: '\\[', inConstruct: 'phrasing'}, | ||
{ | ||
character: '!', | ||
after: '\\[', | ||
inConstruct: 'phrasing', | ||
notInConstruct: fullPhrasingSpans | ||
}, | ||
// A quote can break out of a title. | ||
@@ -58,3 +78,9 @@ {character: '"', inConstruct: 'titleQuote'}, | ||
{character: '(', inConstruct: 'destinationRaw'}, | ||
{before: '\\]', character: '(', inConstruct: 'phrasing'}, | ||
// A left paren followed by `]` could make something into a link or image. | ||
{ | ||
before: '\\]', | ||
character: '(', | ||
inConstruct: 'phrasing', | ||
notInConstruct: fullPhrasingSpans | ||
}, | ||
// A right paren could start a list item or break out of a destination | ||
@@ -66,3 +92,3 @@ // raw. | ||
{atBreak: true, character: '*'}, | ||
{character: '*', inConstruct: 'phrasing'}, | ||
{character: '*', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans}, | ||
// A plus sign could start a list item. | ||
@@ -82,3 +108,8 @@ {atBreak: true, character: '+'}, | ||
{atBreak: true, character: '<', after: '[!/?A-Za-z]'}, | ||
{character: '<', after: '[!/?A-Za-z]', inConstruct: 'phrasing'}, | ||
{ | ||
character: '<', | ||
after: '[!/?A-Za-z]', | ||
inConstruct: 'phrasing', | ||
notInConstruct: fullPhrasingSpans | ||
}, | ||
{character: '<', inConstruct: 'destinationLiteral'}, | ||
@@ -94,3 +125,4 @@ // An equals to can start setext heading underlines. | ||
{atBreak: true, character: '['}, | ||
{character: '[', inConstruct: ['phrasing', 'label', 'reference']}, | ||
{character: '[', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans}, | ||
{character: '[', inConstruct: ['label', 'reference']}, | ||
// A backslash can start an escape (when followed by punctuation) or a | ||
@@ -105,3 +137,3 @@ // hard break (when followed by an eol). | ||
{atBreak: true, character: '_'}, | ||
{character: '_', inConstruct: 'phrasing'}, | ||
{character: '_', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans}, | ||
// A grave accent can start code (fenced or text), or it can break out of | ||
@@ -112,8 +144,5 @@ // a grave accent code fence. | ||
character: '`', | ||
inConstruct: [ | ||
'codeFencedLangGraveAccent', | ||
'codeFencedMetaGraveAccent', | ||
'phrasing' | ||
] | ||
inConstruct: ['codeFencedLangGraveAccent', 'codeFencedMetaGraveAccent'] | ||
}, | ||
{character: '`', inConstruct: 'phrasing', notInConstruct: fullPhrasingSpans}, | ||
// Left brace, vertical bar, right brace are not used in markdown for | ||
@@ -120,0 +149,0 @@ // constructs. |
{ | ||
"name": "mdast-util-to-markdown", | ||
"version": "1.2.3", | ||
"version": "1.2.4", | ||
"description": "mdast utility to serialize markdown", | ||
@@ -61,3 +61,3 @@ "license": "MIT", | ||
"unist-util-remove-position": "^4.0.0", | ||
"xo": "^0.44.0" | ||
"xo": "^0.45.0" | ||
}, | ||
@@ -64,0 +64,0 @@ "scripts": { |
@@ -261,4 +261,2 @@ # mdast-util-to-markdown | ||
— serialize directives | ||
* [`syntax-tree/mdast-util-footnote`](https://github.com/syntax-tree/mdast-util-footnote) | ||
— serialize footnotes | ||
* [`syntax-tree/mdast-util-frontmatter`](https://github.com/syntax-tree/mdast-util-frontmatter) | ||
@@ -270,2 +268,4 @@ — serialize frontmatter (YAML, TOML, more) | ||
— serialize GFM autolink literals | ||
* [`syntax-tree/mdast-util-gfm-footnote`](https://github.com/syntax-tree/mdast-util-gfm-footnote) | ||
— serialize GFM footnotes | ||
* [`syntax-tree/mdast-util-gfm-strikethrough`](https://github.com/syntax-tree/mdast-util-gfm-strikethrough) | ||
@@ -272,0 +272,0 @@ — serialize GFM strikethrough |
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
92191
2622