Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: MarkdownImport does not escape plus signs in the provided tag #3596

Closed
tehapo opened this issue Dec 20, 2022 · 1 comment · Fixed by #3599 or #3630
Closed

Bug: MarkdownImport does not escape plus signs in the provided tag #3596

tehapo opened this issue Dec 20, 2022 · 1 comment · Fixed by #3599 or #3630

Comments

@tehapo
Copy link
Contributor

tehapo commented Dec 20, 2022

I was trying to use ++ as the tag for underline when converting to and from Markdown by adding a custom TextFormatTransformer. Unfortunately this fails with an invalid regular expression error.

Looking at the source code, it seems to me like this could be fixed by escaping the plus sign in MarkdownImport, but I don't know if there are any unwanted side-effects of doing that.

// This...
const tagRegExp = tag.replace(/(\*|\^)/g, '\\$1');

// ...should also include the plus sign?
const tagRegExp = tag.replace(/(\*|\^|\+)/g, '\\$1');

This is the TextFormatTransformer I was trying to use.

{
  format: ['underline'],
  tag: '++',
  type: 'text-format'
}
@tehapo tehapo changed the title MarkdownImport does not escape plus signs in the provided tag Bug: MarkdownImport does not escape plus signs in the provided tag Dec 20, 2022
@tehapo tehapo changed the title Bug: MarkdownImport does not escape plus signs in the provided tag Bug: MarkdownImport does not escape plus signs in the provided tag Dec 20, 2022
@fantactuka
Copy link
Contributor

Sounds reasonable, feel free to create a PR! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants