Skip to content

Commit

Permalink
Merge pull request #644 from robertKozik/remove-data-attribute-escape
Browse files Browse the repository at this point in the history
Stop escaping codeFence data-code-raw attribute data
  • Loading branch information
marcaaron authored Feb 8, 2024
2 parents 6ae333c + cc418d0 commit c85dc9b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion __tests__/ExpensiMark-HTML-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,7 @@ describe('when should keep raw input flag is enabled', () => {

test('quote with other markdowns', () => {
const quoteTestStartString = '>This is a *quote* that started on a new line.\nHere is a >quote that did not\n```\nhere is a codefenced quote\n>it should not be quoted\n```';
const quoteTestReplacedString = '<blockquote>This is a <strong>quote</strong> that started on a new line.</blockquote>\nHere is a &gt;quote that did not\n<pre data-code-raw=\"\nhere is a codefenced quote\n&amp;gt;it should not be quoted\n\">here&#32;is&#32;a&#32;codefenced&#32;quote\n&gt;it&#32;should&#32;not&#32;be&#32;quoted\n</pre>';
const quoteTestReplacedString = '<blockquote>This is a <strong>quote</strong> that started on a new line.</blockquote>\nHere is a &gt;quote that did not\n<pre data-code-raw=\"\nhere is a codefenced quote\n&gt;it should not be quoted\n\">here&#32;is&#32;a&#32;codefenced&#32;quote\n&gt;it&#32;should&#32;not&#32;be&#32;quoted\n</pre>';

expect(parser.replace(quoteTestStartString, {shouldKeepRawInput: true})).toBe(quoteTestReplacedString);
});
Expand Down
2 changes: 1 addition & 1 deletion lib/ExpensiMark.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default class ExpensiMark {
rawInputReplacement: (match, __, textWithinFences) => {
const withinFences = match.replace(/(?:&#x60;&#x60;&#x60;)([\s\S]*?)(?:&#x60;&#x60;&#x60;)/g, '$1');
const group = textWithinFences.replace(/(?:(?![\n\r])\s)/g, '&#32;');
return `<pre data-code-raw="${_.escape(withinFences)}">${group}</pre>`;
return `<pre data-code-raw="${withinFences}">${group}</pre>`;
}
},

Expand Down

0 comments on commit c85dc9b

Please sign in to comment.