jmd-format 0.2.0 → 0.2.1
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/parser.js +9 -5
package/package.json
CHANGED
package/src/parser.js
CHANGED
|
@@ -155,11 +155,15 @@ export function createParser() {
|
|
|
155
155
|
|
|
156
156
|
function onThematicBreak() {
|
|
157
157
|
blankPending = false
|
|
158
|
-
// A thematic break
|
|
159
|
-
//
|
|
160
|
-
//
|
|
161
|
-
//
|
|
162
|
-
//
|
|
158
|
+
// A thematic break closes any sub-scope opened by the most-recent
|
|
159
|
+
// item, then signals the next item of the enclosing array (spec §8.6).
|
|
160
|
+
// We search outward for the innermost array whose last item opened a
|
|
161
|
+
// sub-structure and close down to it. If none qualifies, the break is
|
|
162
|
+
// a no-op — and that is correct, not lossy: a flat item opens no
|
|
163
|
+
// sub-scope, so the enclosing array is still current and the next
|
|
164
|
+
// `- ` item continues it. This is why a `---` after a flat item in a
|
|
165
|
+
// mixed array (canonical per the v0.3.4 §8.6 clarification) parses
|
|
166
|
+
// without dropping the following item.
|
|
163
167
|
let targetIdx = -1
|
|
164
168
|
for (let i = stack.length - 1; i >= 0; i--) {
|
|
165
169
|
const s = stack[i]
|