mdld-parse 0.4.2 → 0.4.3
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/package.json +1 -1
- package/src/parse.js +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdld-parse",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "A standards-compliant parser for **MD-LD (Markdown-Linked Data)** — a human-friendly RDF authoring format that extends Markdown with semantic annotations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
package/src/parse.js
CHANGED
|
@@ -61,6 +61,11 @@ function createToken(type, range, text, attrs = null, attrsRange = null, valueRa
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
function getCarriers(token) {
|
|
64
|
+
// Skip inline carrier extraction for code blocks to allow safe self-documentation
|
|
65
|
+
if (token.type === 'code') {
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
68
|
+
|
|
64
69
|
if (!token._carriers) {
|
|
65
70
|
token._carriers = extractInlineCarriers(token.text, token.range[0]);
|
|
66
71
|
}
|
|
@@ -834,6 +839,10 @@ export function parse(text, options = {}) {
|
|
|
834
839
|
processTokenAnnotations(token, state, token.type);
|
|
835
840
|
break;
|
|
836
841
|
case 'code':
|
|
842
|
+
// Process annotations on the opening fence, but skip content processing
|
|
843
|
+
// This allows safe self-explaining of the format in documentation
|
|
844
|
+
processTokenAnnotations(token, state, token.type);
|
|
845
|
+
break;
|
|
837
846
|
case 'blockquote':
|
|
838
847
|
processTokenAnnotations(token, state, token.type);
|
|
839
848
|
break;
|