diff --git a/lib/marked.js b/lib/marked.js index 21c5573dbc..b29fda9924 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -469,7 +469,7 @@ var inline = { nolink: /^!?\[((?:\[[^\]]*\]|\\[\[\]]|[^\[\]])*)\]/, strong: /^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/, em: /^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/, - code: /^(`+)([\s\S]*?[^`])\1(?!`)/, + code: /^(`+)(\s*)([\s\S]*?[^`]?)\2\1(?!`)/, br: /^ {2,}\n(?!\s*$)/, del: noop, text: /^[\s\S]+?(?=[\\hi ther `` ok ```

+ +

`

+ +

There is a literal backtick (`) here.

+ +

A backtick-delimited string in a code span: `foo`

+ +

Please don't use any <blink> tags.

\ No newline at end of file diff --git a/test/new/nested_code.md b/test/new/nested_code.md index 910e3d4628..adde417713 100644 --- a/test/new/nested_code.md +++ b/test/new/nested_code.md @@ -1 +1,9 @@ ````` hi ther `` ok ``` ````` + +`` ` `` + +``There is a literal backtick (`) here.`` + +A backtick-delimited string in a code span: `` `foo` `` + +Please don't use any `` tags. \ No newline at end of file