-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore: upgrade remark-parse to 9.0.0 #171
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -199,7 +199,7 @@ describe("processor", () => { | |
|
||
assert.strictEqual(blocks.length, 1); | ||
assert.strictEqual(blocks[0].filename, "0.js"); | ||
assert.strictEqual(blocks[0].text, "\n\n \n \n"); | ||
assert.strictEqual(blocks[0].text, "\n\n\n \n \n"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aha! This reminded me of both #77 and #78. After some digging, it turns out |
||
}); | ||
|
||
it("should ignore code fences with unspecified info string", () => { | ||
|
@@ -362,7 +362,7 @@ describe("processor", () => { | |
const blocks = processor.preprocess(code); | ||
|
||
assert.strictEqual(blocks[0].filename, "0.js"); | ||
assert.strictEqual(blocks[0].text, "var answer = 6 * 7;\nconsole.log(answer);\n"); | ||
assert.strictEqual(blocks[0].text, "var answer = 6 * 7;\r\nconsole.log(answer);\n"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is... strange. It says it "preserves" the original line endings, yet the assertion normalized them to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, I agree it's weird. I think the last line of the code block is always normalized to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh no, it's actually due to this: It always adds a blank line and to the node value, and use For reference, here's the snippet I used to check the upstream implementation is working as expected: console.log(
require('mdast-util-from-markdown')([
"```js",
"var answer = 6 * 7;",
"console.log(answer);",
"```"
].join("\r\n")).children[0].value
); // 'var answer = 6 * 7;\r\nconsole.log(answer);' |
||
}); | ||
|
||
it("should unindent space-indented code fences", () => { | ||
|
@@ -646,8 +646,8 @@ describe("processor", () => { | |
const result = processor.postprocess(messages); | ||
|
||
assert.strictEqual(result[2].column, 9); | ||
assert.strictEqual(result[3].column, 2); | ||
assert.strictEqual(result[4].column, 2); | ||
assert.strictEqual(result[3].column, 4); | ||
assert.strictEqual(result[4].column, 4); | ||
}); | ||
|
||
it("should adjust fix range properties", () => { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this change is valid in the case of "negative" indents, i.e. lines of code in a code block that are less indented than the opening fence. The parser previously gave us those on a per-line basis so we could make the correct adjustment. That shows up in the change to the "should translate indented column numbers" test, where one of the messages' columns (4) is now greater than the line length (2).