Skip to content

Commit

Permalink
Merge pull request #97 from sungho-kim/vertical-bar-escape
Browse files Browse the repository at this point in the history
Add vertical bar regexp for escape fixes #96
  • Loading branch information
junghwan-park authored and seonim-ryu committed Feb 5, 2020
1 parent d2f2b08 commit d943c5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libs/to-mark/src/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ Renderer.markdownTextToEscapeRx = {
strikeThrough: /~~(\S[\s\S]*\S)~~/,
code: /(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,

verticalBar: /\u007C/,

codeblockGfm: /^(`{3,})/
};

Expand Down
5 changes: 5 additions & 0 deletions libs/to-mark/test/toMark.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ describe('toMark', function() {
expect(toMark()).toEqual('');
expect(toMark(null)).toEqual('');
});
it('should escape vertical bars', function() {
expect(toMark('<div>1 | Introduction</div>')).toEqual('<div>1 \\| Introduction</div>');
expect(toMark('<p>|||, Exercise</p>')).toEqual('\\|\\|\\|, Exercise');
expect(toMark('<b>|go ro Work|</b>')).toEqual('**\\|go ro Work\\|**');
});
it('markdown text\'s EOL FOL newline characters should be removed', function() {
expect(toMark('<h1>Hello World</h1>')).toEqual('# Hello World');
expect(toMark('<h1>Hello World</h1><br />')).toEqual('# Hello World');
Expand Down

0 comments on commit d943c5d

Please sign in to comment.