-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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 task-list checkbox styling #10668
Conversation
The pandoc renderer will append the class "task-list" to the ul element wrapping a li with one or more check-boxes. This allows us to select for them, removing their list-style-type property. However, goldmark and the gfm spec doesn't specify the "task-list" class name, so we can't use that to fix the issue there. Signed-off-by: Alexander Scheel <[email protected]>
This version adds the missing space after a checkbox. Resolves: go-gitea#9656 Signed-off-by: Alexander Scheel <[email protected]>
Latest go 1.13 should be fine. We're not on 1.14 yet. This is LGTM, besides the odd checkbox rendering in those screenshots, but it's not related to this PR. |
Nevermind, it does work with pandoc enabled, e.g.
|
Sorry, what's wrong with the checkboxes? If/when we get a class on the But the checkboxes themselves are correct. I'm on Fedora 31, under GNOME, and they match the system theme:
What are your rendering settings? As I mentioned above ("Styles task-lists to remove the bullets, when rendered with pandoc."), you have to use pandoc. My config is: [markup.sanitizer]
ELEMENT = span
ALLOW_ATTR = class
REGEXP = ^(math\s*|inline\s*|display\s*){0,3}$
[markup.markdown]
ENABLED = true
FILE_EXTENSIONS = .md,.markdown
RENDER_COMMAND = bash /home/git/custom/conf/pandoc.sh $ cat pandoc.sh
#!/bin/bash
export PANDOC_GITEA_PREFIX_SRC="$GITEA_PREFIX_SRC"
export PANDOC_GITEA_PREFIX_RAW="$GITEA_PREFIX_RAW"
pandoc -f markdown -t html -M PANDOC_GITEA_PREFIX_SRC="$GITEA_PREFIX_SRC" -M PANDOC_GITEA_PREFIX_RAW="$GITEA_PREFIX_RAW" --lua-filter=/home/git/custom/conf/pandoc.lua --katex |
Ah, that's why. They just look a bit "unusual" to me 😉 Thanks for the pandoc info, I just switched to it. |
So to get this to work with the bluemonday sanitizer too, we need goldmark to add the class, right? Would you mind opening a goldmark issue on it? |
Codecov Report
@@ Coverage Diff @@
## master #10668 +/- ##
==========================================
+ Coverage 43.61% 43.61% +<.01%
==========================================
Files 588 588
Lines 82487 82490 +3
==========================================
+ Hits 35973 35979 +6
+ Misses 42053 42052 -1
+ Partials 4461 4459 -2
Continue to review full report at Codecov.
|
@silverwind Yes, I can file the issue when I get back. I was trying to figure out how to add the class earlier but I didn't get far enough. |
@silverwind -- filed as yuin/goldmark#113. |
Continuing on from #10668 this PR makes goldmark apply the task-list styling to task-lists.
This pull request does two things:
goldmark-pr#112
.#9656 strictly describes the missing space. However, commenters asked for the bullet to be removed as well. This is a little more tricky as the GFM spec doesn't mention adding a class to the
<ul>
(the way pandoc does). It might be possible to convince the goldmark maintainer to add that class though, I'm not sure.An alternative is to wait until CSS4 selectors are available. This should include the
:has()
selector, which would allow us to select based on containing an input field. Something likeli:has(input[type="checkbox"])
. But caniuse says I can't use it because nobody supports it.When rendered with Pandoc, it now looks like:
When rendered with Goldmark, it now looks like:
Note: I'm using go v1.13.6 and it looks like the
go.sum
file didn't change correctly. What version of go should I be using to match this project'sgo.sum
file preferences?