mirror of
https://github.com/danbulant/discord.js
synced 2026-05-25 13:02:38 +00:00
Added onlyInlineCode to escapeMarkdown
This commit is contained in:
parent
d0463926c4
commit
caec3648c0
1 changed files with 2 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
|||
module.exports = function escapeMarkdown(text, onlyCodeBlock = false) {
|
||||
module.exports = function escapeMarkdown(text, onlyCodeBlock = false, onlyInlineCode = false) {
|
||||
if (onlyCodeBlock) return text.replace(/```/g, '`\u200b``');
|
||||
if (onlyInlineCode) return text.replace(/\\(`|\\)/g, '$1').replace(/(`|\\)/g, '\\$1');
|
||||
return text.replace(/\\(\*|_|`|~|\\)/g, '$1').replace(/(\*|_|`|~|\\)/g, '\\$1');
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue