Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function preprocess(text) {
var comments = [];
var index, previousNode, comment;

if (node.lang && SUPPORTED_SYNTAXES.indexOf(node.lang.toLowerCase()) >= 0) {
if (node.lang && SUPPORTED_SYNTAXES.indexOf(node.lang.split(" ")[0].toLowerCase()) >= 0) {
index = parent.children.indexOf(node) - 1;
previousNode = parent.children[index];
while (previousNode && previousNode.type === "html") {
Expand Down
11 changes: 11 additions & 0 deletions tests/lib/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,17 @@ describe("processor", function() {
assert.equal(blocks.length, 1);
});

it("should ignore anything after the first word of the info string", function() {
var code = [
"```js more words are ignored",
"var answer = 6 * 7;",
"```"
].join("\n");
var blocks = processor.preprocess(code);

assert.equal(blocks.length, 1);
});

it("should find code fences not surrounded by blank lines", function() {
var code = [
"<!-- eslint-disable -->",
Expand Down