Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Package registry
Operate
Terraform modules
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
thomasDOTwtf
hub
Commits
49bc07a5
Commit
49bc07a5
authored
Nov 25, 2023
by
HeJ
Committed by
Roang
Nov 26, 2023
Browse files
Options
Downloads
Patches
Plain Diff
markdown: handle HTML comments properly
parent
e8bfe084
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/core/markdown.py
+6
-0
6 additions, 0 deletions
src/core/markdown.py
with
6 additions
and
0 deletions
src/core/markdown.py
+
6
−
0
View file @
49bc07a5
...
@@ -96,6 +96,9 @@ class MyHtmlRenderer(HTMLRenderer):
...
@@ -96,6 +96,9 @@ class MyHtmlRenderer(HTMLRenderer):
@staticmethod
@staticmethod
def
render_html_span
(
token
):
def
render_html_span
(
token
):
if
token
.
content
.
startswith
(
"
<!--
"
):
# HTML comments can be rendered as-is
return
token
.
content
return
html
.
escape
(
token
.
content
)
return
html
.
escape
(
token
.
content
)
def
render_alert_block
(
self
,
token
:
AlertBlock
)
->
str
:
def
render_alert_block
(
self
,
token
:
AlertBlock
)
->
str
:
...
@@ -216,6 +219,9 @@ class MyHtmlRenderer(HTMLRenderer):
...
@@ -216,6 +219,9 @@ class MyHtmlRenderer(HTMLRenderer):
class
MySanitizedHtmlRenderer
(
MyHtmlRenderer
):
class
MySanitizedHtmlRenderer
(
MyHtmlRenderer
):
@staticmethod
@staticmethod
def
render_html_block
(
token
):
def
render_html_block
(
token
):
if
token
.
content
.
startswith
(
"
<!--
"
):
# HTML comments can be rendered as-is
return
token
.
content
return
html
.
escape
(
token
.
content
)
return
html
.
escape
(
token
.
content
)
@staticmethod
@staticmethod
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment