Skip to content

Escape { in user supplied html#408

Merged
mishig25 merged 10 commits into
mainfrom
fix_escaping_inside_html
Sep 26, 2023
Merged

Escape { in user supplied html#408
mishig25 merged 10 commits into
mainfrom
fix_escaping_inside_html

Conversation

@mishig25

@mishig25 mishig25 commented Sep 25, 2023

Copy link
Copy Markdown
Contributor

Problem

When there { is within a user supplied html string, it was causing svelte compiler error since { is a reserved character.

Solution

Escape { with {

Description of steps:

  1. When there a html string inside mdsvex files, marked AST parses the outer most tag without without further parsing. For example, <div><p>test</p></div> will be parsed as single node without children. AST playground
  2. Therefore, when there is a html node, parse it further with cheerio and replace { with &#123; within texts
  3. Problem solved

Should fix https://github.com/xenova/transformers.js/actions/runs/6300637437/job/17103917897?pr=320

todos:

@mishig25
mishig25 force-pushed the fix_escaping_inside_html branch from e8c837a to 031eef1 Compare September 25, 2023 21:02
mishig25 added a commit to huggingface/transformers that referenced this pull request Sep 25, 2023
mishig25 pushed a commit to mishig25/transformers.js that referenced this pull request Sep 25, 2023
mishig25 added a commit to huggingface/course that referenced this pull request Sep 26, 2023
@mishig25
mishig25 merged commit ed0bce7 into main Sep 26, 2023
@mishig25
mishig25 deleted the fix_escaping_inside_html branch September 26, 2023 14:42
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.

1 participant