-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix markdown color code detection #30208
Conversation
When reviewing PRs, some color names might be mentioned, the `transformCodeSpan` (which calls `css.ColorHandler`) considered it as a valid color, but actually it shouldn't be rendered as a color codespan.
Backport #30208 by wxiaoguang When reviewing PRs, some color names might be mentioned, the `transformCodeSpan` (which calls `css.ColorHandler`) considered it as a valid color, but actually it shouldn't be rendered as a color codespan. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@@ -49,9 +49,28 @@ func (r *HTMLRenderer) renderCodeSpan(w util.BufWriter, source []byte, n ast.Nod | |||
return ast.WalkContinue, nil | |||
} | |||
|
|||
// cssColorHandler checks if a string is a render-able CSS color value. | |||
// The code is from "github.com/microcosm-cc/bluemonday/css.ColorHandler", except that it doesn't handle color words like "red". |
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.
This "link" is 404. I wonder if it can handle hex RRGGBBAA syntax.
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.
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.
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.
Ok. Seems far-fetched that a IDE should highlight inside "links". Better to put web links next time.
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.
And no, I don't mean rgba()
syntax, bug #rrggbbaa
and also #rgba
.
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.
It's a upstream bug that it does not support 4-digit #rgba
:
https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color#syntax
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.
Ok. Seems far-fetched that a IDE should highlight inside "links". Better to put web links next time.
But Golang's package import is not a link, it is just a package path : "github.com/microcosm-cc/bluemonday/css"
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.
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.
No, it only support 3,6,8 length, not 4 length.
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.
Opened microcosm-cc/bluemonday#207
* giteaofficial/main: Remove fomantic input module (go-gitea#30194) Remove most jQuery function calls from the repository topic box (go-gitea#30191) Prevent flash of dropdown menu on labels list (go-gitea#30215) Remove jQuery class from the `repo-issue.js` file (go-gitea#30192) Ignore fomantic folder in linters (go-gitea#30200) Remove `modifies/frontend` from labeler (go-gitea#30198) Make a distinction between `active` and `selected` in the issue author dropdown (go-gitea#30207) Move and simplify tab-size helpers (go-gitea#30196) Fix markdown color code detection (go-gitea#30208)
When reviewing PRs, some color names might be mentioned, the
transformCodeSpan
(which callscss.ColorHandler
) considered it as a valid color, but actually it shouldn't be rendered as a color codespan.