Skip to content

Commit

Permalink
Merge pull request #90 from khaosdoctor/fix/escape-tags
Browse files Browse the repository at this point in the history
Escape tag characters
  • Loading branch information
zolrath authored Jan 4, 2024
2 parents 000849a + 08c6881 commit 48e7aae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ export default class AutoLinkTitle extends Plugin {
}

escapeMarkdown(text: string): string {
var unescaped = text.replace(/\\(\*|_|`|~|\\|\[|\])/g, '$1'); // unescape any "backslashed" character
var escaped = unescaped.replace(/(\*|_|`|~|\\|\[|\])/g, '\\$1'); // escape *, _, `, ~, \, [, ]
return escaped;
var unescaped = text.replace(/\\(\*|_|`|~|\\|\[|\])/g, '$1') // unescape any "backslashed" character
var escaped = unescaped.replace(/(\*|_|`|<|>|~|\\|\[|\])/g, '\\$1') // escape *, _, `, ~, \, [, ], <, and >
return escaped
}

async fetchUrlTitle(url: string): Promise<string> {
Expand Down

0 comments on commit 48e7aae

Please sign in to comment.