Skip to content

Commit 8437ba2

Browse files
committed
Fixed a backtick parsing issue
- Fixes #136
1 parent d647b9d commit 8437ba2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

lib/parser.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ exports.parse = (markdown) => {
4040
}
4141
}
4242
let example = page.examples[page.examples.length-1];
43-
if (example) {
43+
// If example exists and a code is already not added
44+
if (example && !example.code) {
4445
example.code = unhtml(text);
4546
}
4647
return text;

test/parser.spec.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ describe('Parser', () => {
119119
120120
\`cmd2 --foo\``
121121
);
122+
page.examples[0].code.should.eql('cmd1 --foo');
123+
page.examples[1].code.should.eql('cmd2 --foo');
122124
page.examples[0].description.should.eql('example 1, see inline_cmd1 for details');
123125
page.examples[1].description.should.eql('example 2, see inline_cmd2 for details');
124126
});

0 commit comments

Comments
 (0)