Skip to content

Commit

Permalink
Update: Support jsx code fences (fixes #19)
Browse files Browse the repository at this point in the history
  • Loading branch information
btmills committed Sep 20, 2015
1 parent aa78bf5 commit e153fd4
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
Expand Up @@ -63,7 +63,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
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 e153fd4

Please sign in to comment.