pantsdown 1.6.0 → 1.6.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/lexer.ts +1 -1
- package/src/tokenizer.ts +8 -2
- package/src/types.ts +1 -1
- package/bunfig.toml +0 -2
package/package.json
CHANGED
package/src/lexer.ts
CHANGED
|
@@ -57,7 +57,7 @@ export class Lexer {
|
|
|
57
57
|
const tokenLines = rawToken.split("\n");
|
|
58
58
|
const sourceMap: SourceMap = [this.line, (this.line += tokenLines.length - 1)];
|
|
59
59
|
|
|
60
|
-
while (tokenLines.
|
|
60
|
+
while (tokenLines[tokenLines.length - 1] === "") {
|
|
61
61
|
// token.raw sometimes includes newline chars at the end of the string
|
|
62
62
|
// which we don't want to include in the sourceMap
|
|
63
63
|
tokenLines.pop();
|
package/src/tokenizer.ts
CHANGED
|
@@ -283,19 +283,25 @@ export class Tokenizer {
|
|
|
283
283
|
loose: false,
|
|
284
284
|
text: itemContents,
|
|
285
285
|
tokens: [],
|
|
286
|
+
sourceMap: this.lexer.getSourceMap(raw),
|
|
286
287
|
});
|
|
287
288
|
|
|
288
289
|
list.raw += raw;
|
|
289
290
|
}
|
|
290
291
|
|
|
291
292
|
// Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
|
|
292
|
-
|
|
293
|
+
const lastTrimmed = raw.trimEnd();
|
|
294
|
+
|
|
295
|
+
if (list.items[list.items.length - 1]!.sourceMap) {
|
|
296
|
+
this.lexer.line -= raw.length - lastTrimmed.length;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
list.items[list.items.length - 1]!.raw = lastTrimmed;
|
|
293
300
|
list.items[list.items.length - 1]!.text = itemContents.trimEnd();
|
|
294
301
|
list.raw = list.raw.trimEnd();
|
|
295
302
|
|
|
296
303
|
// Item child tokens handled here at end because we needed to have the final item to trim it first
|
|
297
304
|
for (let i = 0, listItemsLen = list.items.length; i < listItemsLen; i++) {
|
|
298
|
-
list.items[i]!.sourceMap = this.lexer.getSourceMap(list.items[i]!.raw);
|
|
299
305
|
this.lexer.state.top = false;
|
|
300
306
|
list.items[i]!.tokens = this.lexer.blockTokens(list.items[i]!.text, []);
|
|
301
307
|
|
package/src/types.ts
CHANGED
package/bunfig.toml
DELETED