-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
fix: ignore html tags in inline code syntax #11821
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,6 +128,10 @@ export function createExcerpt(fileString: string): string | undefined { | |
| } | ||
|
|
||
| const cleanedLine = fileLine | ||
| // Remove inline code. | ||
| .replace(/`(?<text>.+?)`/g, (_match, p1) => { | ||
| return p1.replaceAll('<', '<').replaceAll('>', '>'); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| }) | ||
| // Remove HTML tags. | ||
| .replace(/<[^>]*>/g, '') | ||
| // Remove Title headers | ||
|
|
@@ -144,8 +148,6 @@ export function createExcerpt(fileString: string): string | undefined { | |
| .replace(/\[\^.+?\](?:: .*$)?/g, '') | ||
| // Remove inline links. | ||
| .replace(/\[(?<alt>.*?)\][[(].*?[\])]/g, '$1') | ||
| // Remove inline code. | ||
| .replace(/`(?<text>.+?)`/g, '$1') | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand why you moved this to the top: to escape tags before HTML tags get removed Unfortunately, escaping doesn't work, so one solution that could work would be to use marker tags for |
||
| // Remove blockquotes. | ||
| .replace(/^\s{0,3}>\s?/g, '') | ||
| // Remove admonition definition. | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment is wrong, we don't remove them anymore but we unwrap them