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

v8 development #559

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

v8 development #559

wants to merge 13 commits into from

Conversation

quantizor
Copy link
Owner

@quantizor quantizor commented Mar 22, 2024

Objectives

  • allow for multiple rendering targets (react, solid, etc) punting this one to a future major so this can be released faster
  • simplify text-handling regexes to optimize speed and complexity
  • general codebase refactoring / profiling to remove bottlenecks
  • potentially update the library name if we support rendering targets other than JSX punting this one to a future major so this can be released faster
  • expose the parser so it can be used without directly compiling to a target
  • custom rule support
  • ability to disable/enable particular rules
  • documentation

This allows for direct use of the markdown-to-jsx AST if it's preferable
for your use case to retain full control over output.
Copy link

changeset-bot bot commented Mar 22, 2024

🦋 Changeset detected

Latest commit: b61048d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
markdown-to-jsx Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@quantizor quantizor changed the title allow for standalone use of AST parser, start isolating React rendering to allow for other renderers potentially v8 development Apr 5, 2024
@quantizor quantizor mentioned this pull request Apr 5, 2024
const TEXT_STRIKETHROUGHED_R = new RegExp(`^~~${INLINE_SKIP_R}~~`)
// https://regexr.com/7u91c
const INLINE_FORMATTING_R =
/^(([*_])\2|[*_]|~~|==)((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|([*_]+|`|~~|==)[\s\S]+?\4|[\s\S])+?)\1/

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with '*' and containing many repetitions of '<>'.
const TEXT_STRIKETHROUGHED_R = new RegExp(`^~~${INLINE_SKIP_R}~~`)
// https://regexr.com/7u91c
const INLINE_FORMATTING_R =
/^(([*_])\2|[*_]|~~|==)((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|([*_]+|`|~~|==)[\s\S]+?\4|[\s\S])+?)\1/

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with '*[' and containing many repetitions of ']()['.
const TEXT_STRIKETHROUGHED_R = new RegExp(`^~~${INLINE_SKIP_R}~~`)
// https://regexr.com/7u91c
const INLINE_FORMATTING_R =
/^(([*_])\2|[*_]|~~|==)((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|([*_]+|`|~~|==)[\s\S]+?\4|[\s\S])+?)\1/

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with '*[](' and containing many repetitions of ')[]('.
const TEXT_STRIKETHROUGHED_R = new RegExp(`^~~${INLINE_SKIP_R}~~`)
// https://regexr.com/7u91c
const INLINE_FORMATTING_R =
/^(([*_])\2|[*_]|~~|==)((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|([*_]+|`|~~|==)[\s\S]+?\4|[\s\S])+?)\1/

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with '*<' and containing many repetitions of '><'.
const TEXT_STRIKETHROUGHED_R = new RegExp(`^~~${INLINE_SKIP_R}~~`)
// https://regexr.com/7u91c
const INLINE_FORMATTING_R =
/^(([*_])\2|[*_]|~~|==)((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|([*_]+|`|~~|==)[\s\S]+?\4|[\s\S])+?)\1/

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with '*<>' and containing many repetitions of '<><>'.
const TEXT_STRIKETHROUGHED_R = new RegExp(`^~~${INLINE_SKIP_R}~~`)
// https://regexr.com/7u91c
const INLINE_FORMATTING_R =
/^(([*_])\2|[*_]|~~|==)((?:\[.*?\][([].*?[)\]]|<.*?>(?:.*?<.*?>)?|([*_]+|`|~~|==)[\s\S]+?\4|[\s\S])+?)\1/

Check failure

Code scanning / CodeQL

Inefficient regular expression High

This part of the regular expression may cause exponential backtracking on strings starting with '*<><' and containing many repetitions of '><><'.

This comment was marked as off-topic.

return {
children: parse(capture[1], context),
fallbackChildren: parse(
capture[0].replace(SQUARE_BRACKETS_R, '\\$1'),

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This does not escape backslash characters in the input.
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 this pull request may close these issues.

None yet

1 participant