Skip to content

Commit

Permalink
Merge pull request #22 from eslint/issue19
Browse files Browse the repository at this point in the history
Update: Support jsx code fences (fixes #19)
  • Loading branch information
btmills committed Dec 1, 2015
2 parents 16b1b1c + e153fd4 commit 7633b2a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function parse(text) {
return false;
}

captures = match(/^( {0,3})(`{3,}|~{3,})\h*(?:js|javascript|node)\h*\r?\n/i);
captures = match(/^( {0,3})(`{3,}|~{3,})\h*(?:js|javascript|node|jsx)\h*\r?\n/i);
if (captures) {
return {
indent: captures[1],
Expand Down
11 changes: 11 additions & 0 deletions test/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,17 @@ describe("processor", function() {
assert.equal(blocks.length, 1);
});

it("should find code fences with jsx info string", function() {
var code = [
"```jsx",
"var answer = 6 * 7;",
"```"
].join("\n");
var blocks = processor.preprocess(code);

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

it("should find code fences ignoring info string case", function() {
var code = [
"```JavaScript",
Expand Down

0 comments on commit 7633b2a

Please sign in to comment.