md-annotator 0.5.6 → 0.5.7
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/client/dist/index.html +205 -203
- package/client/src/utils/parser.js +30 -8
- package/package.json +1 -1
|
@@ -101,16 +101,38 @@ export function parseMarkdownToBlocks(markdown) {
|
|
|
101
101
|
continue
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
// Blockquotes
|
|
104
|
+
// Blockquotes & GitHub alerts
|
|
105
105
|
if (trimmed.startsWith('>')) {
|
|
106
106
|
flush()
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
const blockquoteStartLine = currentLineNum
|
|
108
|
+
const bqLines = [trimmed.replace(/^>\s*/, '')]
|
|
109
|
+
|
|
110
|
+
// Collect consecutive blockquote lines
|
|
111
|
+
while (i + 1 < lines.length && lines[i + 1].trim().startsWith('>')) {
|
|
112
|
+
i++
|
|
113
|
+
bqLines.push(lines[i].trim().replace(/^>\s*/, ''))
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Check for GitHub alert syntax: [!NOTE], [!TIP], etc.
|
|
117
|
+
const alertMatch = bqLines[0].match(/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]$/)
|
|
118
|
+
if (alertMatch) {
|
|
119
|
+
blocks.push({
|
|
120
|
+
id: `block-${currentId++}`,
|
|
121
|
+
type: 'alert',
|
|
122
|
+
alertType: alertMatch[1].toLowerCase(),
|
|
123
|
+
content: bqLines.slice(1).join('\n'),
|
|
124
|
+
order: currentId,
|
|
125
|
+
startLine: blockquoteStartLine
|
|
126
|
+
})
|
|
127
|
+
} else {
|
|
128
|
+
blocks.push({
|
|
129
|
+
id: `block-${currentId++}`,
|
|
130
|
+
type: 'blockquote',
|
|
131
|
+
content: bqLines.join('\n'),
|
|
132
|
+
order: currentId,
|
|
133
|
+
startLine: blockquoteStartLine
|
|
134
|
+
})
|
|
135
|
+
}
|
|
114
136
|
continue
|
|
115
137
|
}
|
|
116
138
|
|