Skip to content

Commit

Permalink
Merge pull request #586 from Krishna2323/krishna2323/issue/24281
Browse files Browse the repository at this point in the history
fix: Can strike-through pre code block.
  • Loading branch information
arosiclair authored Oct 13, 2023
2 parents 18bf903 + c7a1da9 commit bdbdf44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions __tests__/ExpensiMark-HTML-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ test('Test code fencing with ExpensiMark syntax outside', () => {

codeFenceExample = '_Test1 ```code``` Test2_';
expect(parser.replace(codeFenceExample)).toBe('_Test1 <pre>code</pre> Test2_');

codeFenceExample = '~Test1 ```code``` Test2~';
expect(parser.replace(codeFenceExample)).toBe('~Test1 <pre>code</pre> Test2~');
});

test('Test code fencing with additional backticks inside', () => {
Expand Down
2 changes: 1 addition & 1 deletion lib/ExpensiMark.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export default class ExpensiMark {
{
name: 'strikethrough',
regex: /\B~((?![\s~])[\s\S]*?[^\s~])~\B(?![^<]*(<\/pre>|<\/code>|<\/a>))/g,
replacement: (match, g1) => (this.containsNonPairTag(g1) ? match : `<del>${g1}</del>`),
replacement: (match, g1) => (g1.includes('<pre>') || this.containsNonPairTag(g1) ? match : `<del>${g1}</del>`),
},
{
name: 'newline',
Expand Down

0 comments on commit bdbdf44

Please sign in to comment.