Skip to content

Commit

Permalink
fix(lists): fix github code blocks not being parsed inside lists
Browse files Browse the repository at this point in the history
Fix ghCodeBlocks not being correctly parsed inside lists. Also, as a side
effect, fixes issues with consecutive lists and extra paragraphs being
added into lists.

Closes #142, Closes #183, Closes #184
  • Loading branch information
tivie committed Aug 1, 2015
1 parent 086c41d commit 7720c88
Show file tree
Hide file tree
Showing 20 changed files with 282 additions and 219 deletions.
180 changes: 75 additions & 105 deletions dist/showdown.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/showdown.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/showdown.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/showdown.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "showdown",
"version": "1.2.1",
"version": "1.2.2",
"description": "A Markdown to HTML converter written in Javascript",
"author": "Estevão Santos",
"homepage": "http://showdownjs.github.io/showdown/",
Expand Down
10 changes: 2 additions & 8 deletions src/subParsers/githubCodeBlocks.js
Expand Up @@ -18,14 +18,8 @@ showdown.subParser('githubCodeBlocks', function (text, options, globals) {

text += '~0';

text = text.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g, function (wholeMatch, m1, m2) {
var language = m1,
codeblock = m2,
end = '\n';

if (options.omitExtraWLInCodeBlocks) {
end = '';
}
text = text.replace(/(?:^|\n)```(.*)\n([\s\S]*?)\n```/g, function (wholeMatch, language, codeblock) {
var end = (options.omitExtraWLInCodeBlocks) ? '' : '\n';

codeblock = showdown.subParser('encodeCode')(codeblock);
codeblock = showdown.subParser('detab')(codeblock);
Expand Down

0 comments on commit 7720c88

Please sign in to comment.