Skip to content

Commit

Permalink
fix: only replace grave accents when vertical pipe
Browse files Browse the repository at this point in the history
The grave accent must be replaced only if a vertical pipe is in the
content. The default should always be the markdown default with grave
accent.
  • Loading branch information
fty4 committed Aug 13, 2022
1 parent cc18ce9 commit e69fb0d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/markdowner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export function markdownEscapeTableCell(text: string): string {
export function markdownEscapeInlineCode(content: string): string {
// replace grave accents with <code> HTML element to resolve unicode character in markdown
// let isClosingTag = false;
return content.replace(/([\s*_]|^)`([^`]+)`([\s*_]|$)/g, '$1<code>$2</code>$3');
if (content.includes('|')) {
content = content.replace(/([\s*_]|^)`([^`]+)`([\s*_]|$)/g, '$1<code>$2</code>$3');
}
return content

// ?.forEach((match) => {
// if (!isClosingTag) {
Expand Down

0 comments on commit e69fb0d

Please sign in to comment.