@readme/markdown 11.8.0 → 11.8.2
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/dist/lib/utils/extractMagicBlocks.d.ts +1 -0
- package/dist/main.js +20 -30
- package/dist/main.node.js +20 -30
- package/dist/main.node.js.map +1 -1
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -35908,10 +35908,15 @@ function remarkGfm(options) {
|
|
|
35908
35908
|
|
|
35909
35909
|
;// ./node_modules/mdast-util-mdx-expression/lib/index.js
|
|
35910
35910
|
/**
|
|
35911
|
-
* @
|
|
35912
|
-
* @
|
|
35913
|
-
* @
|
|
35914
|
-
*
|
|
35911
|
+
* @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext
|
|
35912
|
+
* @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
|
|
35913
|
+
* @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle
|
|
35914
|
+
*
|
|
35915
|
+
* @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle
|
|
35916
|
+
* @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
|
|
35917
|
+
*
|
|
35918
|
+
* @typedef {import('../index.js').MdxFlowExpression} MdxFlowExpression
|
|
35919
|
+
* @typedef {import('../index.js').MdxTextExpression} MdxTextExpression
|
|
35915
35920
|
*/
|
|
35916
35921
|
|
|
35917
35922
|
|
|
@@ -36008,24 +36013,10 @@ function exitMdxExpressionData(token) {
|
|
|
36008
36013
|
/**
|
|
36009
36014
|
* @type {ToMarkdownHandle}
|
|
36010
36015
|
* @param {MdxFlowExpression | MdxTextExpression} node
|
|
36011
|
-
* Node.
|
|
36012
|
-
* @param {Parents | undefined} parent
|
|
36013
|
-
* Parent, if any.
|
|
36014
|
-
* @param {State} state
|
|
36015
|
-
* Info passed around about the current state.
|
|
36016
|
-
* @returns {string}
|
|
36017
|
-
* Serialized markdown.
|
|
36018
36016
|
*/
|
|
36019
|
-
function handleMdxExpression(node
|
|
36017
|
+
function handleMdxExpression(node) {
|
|
36020
36018
|
const value = node.value || ''
|
|
36021
|
-
|
|
36022
|
-
// Tab-size to eat has to be the same as what we serialize as.
|
|
36023
|
-
// While in some places in markdown that’s 4, in JS it’s more common as 2.
|
|
36024
|
-
// Which is what’s also in `mdast-util-mdx-jsx`:
|
|
36025
|
-
// <https://github.com/syntax-tree/mdast-util-mdx-jsx/blob/40b951b/lib/index.js#L52>
|
|
36026
|
-
return (index === 0 || blank ? '' : ' ') + line
|
|
36027
|
-
})
|
|
36028
|
-
return '{' + result + '}'
|
|
36019
|
+
return '{' + value + '}'
|
|
36029
36020
|
}
|
|
36030
36021
|
|
|
36031
36022
|
;// ./node_modules/character-entities-legacy/index.js
|
|
@@ -93914,18 +93905,13 @@ function parseMagicBlock(raw, options = {}) {
|
|
|
93914
93905
|
const magicBlockRestorer = ({ blocks }) => tree => {
|
|
93915
93906
|
if (!blocks.length)
|
|
93916
93907
|
return;
|
|
93917
|
-
//
|
|
93918
|
-
|
|
93919
|
-
// inlineCode nodes without the backticks, so we normalize here
|
|
93920
|
-
const tokenLookup = new Map(blocks.map(({ token, raw }) => {
|
|
93921
|
-
const normalizedToken = token.replace(/^`|`$/g, '');
|
|
93922
|
-
return [normalizedToken, raw];
|
|
93923
|
-
}));
|
|
93908
|
+
// Map: key → original raw magic block content
|
|
93909
|
+
const magicBlockKeys = new Map(blocks.map(({ key, raw }) => [key, raw]));
|
|
93924
93910
|
// Find inlineCode nodes that match our placeholder tokens
|
|
93925
93911
|
visit(tree, 'inlineCode', (node, index, parent) => {
|
|
93926
93912
|
if (!parent || index == null)
|
|
93927
93913
|
return;
|
|
93928
|
-
const raw =
|
|
93914
|
+
const raw = magicBlockKeys.get(node.value);
|
|
93929
93915
|
if (!raw)
|
|
93930
93916
|
return;
|
|
93931
93917
|
// Parse the original magic block and replace the placeholder with the result
|
|
@@ -94021,12 +94007,16 @@ function extractMagicBlocks(markdown) {
|
|
|
94021
94007
|
let index = 0;
|
|
94022
94008
|
const replaced = markdown.replace(MAGIC_BLOCK_REGEX, match => {
|
|
94023
94009
|
/**
|
|
94010
|
+
* Key is the unique identifier for the magic block
|
|
94011
|
+
* Token is a wrapper around the key to serialize & influences how the block is parsed in the pipeline
|
|
94012
|
+
* with the temporary key
|
|
94024
94013
|
* - Use backticks so it becomes a code span, preventing remarkParse from parsing
|
|
94025
94014
|
* special characters in the token as markdown syntax
|
|
94026
94015
|
* - Prepend a newline to the token to ensure it is parsed as a block level node
|
|
94027
94016
|
*/
|
|
94028
|
-
const
|
|
94029
|
-
|
|
94017
|
+
const key = `__MAGIC_BLOCK_${index}__`;
|
|
94018
|
+
const token = `\n\`${key}\``;
|
|
94019
|
+
blocks.push({ key, raw: match, token });
|
|
94030
94020
|
index += 1;
|
|
94031
94021
|
return token;
|
|
94032
94022
|
});
|
package/dist/main.node.js
CHANGED
|
@@ -50076,10 +50076,15 @@ function remarkGfm(options) {
|
|
|
50076
50076
|
|
|
50077
50077
|
;// ./node_modules/mdast-util-mdx-expression/lib/index.js
|
|
50078
50078
|
/**
|
|
50079
|
-
* @
|
|
50080
|
-
* @
|
|
50081
|
-
* @
|
|
50082
|
-
*
|
|
50079
|
+
* @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext
|
|
50080
|
+
* @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension
|
|
50081
|
+
* @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle
|
|
50082
|
+
*
|
|
50083
|
+
* @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle
|
|
50084
|
+
* @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension
|
|
50085
|
+
*
|
|
50086
|
+
* @typedef {import('../index.js').MdxFlowExpression} MdxFlowExpression
|
|
50087
|
+
* @typedef {import('../index.js').MdxTextExpression} MdxTextExpression
|
|
50083
50088
|
*/
|
|
50084
50089
|
|
|
50085
50090
|
|
|
@@ -50176,24 +50181,10 @@ function exitMdxExpressionData(token) {
|
|
|
50176
50181
|
/**
|
|
50177
50182
|
* @type {ToMarkdownHandle}
|
|
50178
50183
|
* @param {MdxFlowExpression | MdxTextExpression} node
|
|
50179
|
-
* Node.
|
|
50180
|
-
* @param {Parents | undefined} parent
|
|
50181
|
-
* Parent, if any.
|
|
50182
|
-
* @param {State} state
|
|
50183
|
-
* Info passed around about the current state.
|
|
50184
|
-
* @returns {string}
|
|
50185
|
-
* Serialized markdown.
|
|
50186
50184
|
*/
|
|
50187
|
-
function handleMdxExpression(node
|
|
50185
|
+
function handleMdxExpression(node) {
|
|
50188
50186
|
const value = node.value || ''
|
|
50189
|
-
|
|
50190
|
-
// Tab-size to eat has to be the same as what we serialize as.
|
|
50191
|
-
// While in some places in markdown that’s 4, in JS it’s more common as 2.
|
|
50192
|
-
// Which is what’s also in `mdast-util-mdx-jsx`:
|
|
50193
|
-
// <https://github.com/syntax-tree/mdast-util-mdx-jsx/blob/40b951b/lib/index.js#L52>
|
|
50194
|
-
return (index === 0 || blank ? '' : ' ') + line
|
|
50195
|
-
})
|
|
50196
|
-
return '{' + result + '}'
|
|
50187
|
+
return '{' + value + '}'
|
|
50197
50188
|
}
|
|
50198
50189
|
|
|
50199
50190
|
;// ./node_modules/character-entities-legacy/index.js
|
|
@@ -114118,18 +114109,13 @@ function parseMagicBlock(raw, options = {}) {
|
|
|
114118
114109
|
const magicBlockRestorer = ({ blocks }) => tree => {
|
|
114119
114110
|
if (!blocks.length)
|
|
114120
114111
|
return;
|
|
114121
|
-
//
|
|
114122
|
-
|
|
114123
|
-
// inlineCode nodes without the backticks, so we normalize here
|
|
114124
|
-
const tokenLookup = new Map(blocks.map(({ token, raw }) => {
|
|
114125
|
-
const normalizedToken = token.replace(/^`|`$/g, '');
|
|
114126
|
-
return [normalizedToken, raw];
|
|
114127
|
-
}));
|
|
114112
|
+
// Map: key → original raw magic block content
|
|
114113
|
+
const magicBlockKeys = new Map(blocks.map(({ key, raw }) => [key, raw]));
|
|
114128
114114
|
// Find inlineCode nodes that match our placeholder tokens
|
|
114129
114115
|
visit(tree, 'inlineCode', (node, index, parent) => {
|
|
114130
114116
|
if (!parent || index == null)
|
|
114131
114117
|
return;
|
|
114132
|
-
const raw =
|
|
114118
|
+
const raw = magicBlockKeys.get(node.value);
|
|
114133
114119
|
if (!raw)
|
|
114134
114120
|
return;
|
|
114135
114121
|
// Parse the original magic block and replace the placeholder with the result
|
|
@@ -114225,12 +114211,16 @@ function extractMagicBlocks(markdown) {
|
|
|
114225
114211
|
let index = 0;
|
|
114226
114212
|
const replaced = markdown.replace(MAGIC_BLOCK_REGEX, match => {
|
|
114227
114213
|
/**
|
|
114214
|
+
* Key is the unique identifier for the magic block
|
|
114215
|
+
* Token is a wrapper around the key to serialize & influences how the block is parsed in the pipeline
|
|
114216
|
+
* with the temporary key
|
|
114228
114217
|
* - Use backticks so it becomes a code span, preventing remarkParse from parsing
|
|
114229
114218
|
* special characters in the token as markdown syntax
|
|
114230
114219
|
* - Prepend a newline to the token to ensure it is parsed as a block level node
|
|
114231
114220
|
*/
|
|
114232
|
-
const
|
|
114233
|
-
|
|
114221
|
+
const key = `__MAGIC_BLOCK_${index}__`;
|
|
114222
|
+
const token = `\n\`${key}\``;
|
|
114223
|
+
blocks.push({ key, raw: match, token });
|
|
114234
114224
|
index += 1;
|
|
114235
114225
|
return token;
|
|
114236
114226
|
});
|