markup/goldmark: Add goldmark-cjk-friendly extension#14115
markup/goldmark: Add goldmark-cjk-friendly extension#14115Martin005 wants to merge 1 commit intogohugoio:masterfrom
goldmark-cjk-friendly extension#14115Conversation
a615f42 to
308ec73
Compare
|
@tats-u Thank you so much for the review! ❤️ Your changes make total sense, I updated the code so that Hugo exposes only You can see the changes in this compare: https://github.com/gohugoio/hugo/compare/a615f42fe14c4878b534752edb1bdd4659261680..308ec733686b96fbb27fb68bc15fdba9110c8e39 Thanks again and if there is anything else I can improve, just let me know 🙂 |
308ec73 to
8f51856
Compare
tats-u
left a comment
There was a problem hiding this comment.
LGTM, waiting for reviews by maintainers.
8f51856 to
3f70a24
Compare
|
With this config: [markup.goldmark.extensions]
strikethrough = true
[markup.goldmark.extensions.cjkFriendly]
emphasis = falseBoth strikethrough and CJKFriendlyStrikethrough are appended to the slice of extensions. Is there a reason for that? |
3f70a24 to
9122724
Compare
Thank you for noticing that. After discussion with @tats-u, I modified it as seen in https://github.com/gohugoio/hugo/compare/3f70a24bb44c54a29c08687ebe026d7b51795058..91227241d58eaabab548d52e712c36257f3184f8. Can we get this PR merged now? I would love to have this feature in the next v0.153.0 release. |
|
OK, this seems to work correctly, but the extensions config is difficult to reason about. We now have three extensions to handle strikethough:
And I think which one is actually used depends on the parse/render priorities, settings that are not exposed to the user. This needs to be thought through...
Someone should probably create a quick flow chart before coding this. It makes my head hurt. EDIT...
|
|
@jmooring To be honest, I don't understand why we would need to hide the Is there anything I can help you with to push this PR to being merged? Thanks! |
|
https://gohugo.io/configuration/markup/#extensions
|
|
There should be no reason to prefer |
|
Don't change this PR until we agree on something, but my take on this is that:
With that said, how about if we, given the pseudo config setup below, created something like: [extensions]
[extensions.delete]
disable = false
weight = 100
[extensions.strikethrough]
disable = true
weight = 200
[extensions.cjk]
disable = true
weight = 300
[extensions.cjkfriendly]
disable = true
weight = 400I have not given much thought to the defaults in the above, but if we used any non-zero weight set as the priority of the extension, then the end user should relatively easy get exactly the behavior he/she wants. And if he/she wants to shoot here/himself in the foot, so be it. |
This case is an exception that X-Z are mutually exclusive and parent-child relationships.
They are also humans. The less amount of config needs to be set to achieve a desired behavior, the better it is. |
Fair enough, I was just trying to nudge this PR to a mergeable state. |
|
|
Per bep's earlier comment, it's probably not wise/not worth changing or updating this PR until an agreement on the direction is reached, otherwise any work might be wasted. |
|
I see. |
d342c09 to
f6696cd
Compare
|
It is a better idea to merge |
f6696cd to
48c8ec0
Compare
|
@Martin005 sorry for the delay; there needs to be some consensus as to what the default config should be (read: A review from jmooring). It's much better to get that right before people start using it. Both me and him is a little bit busy on other fronts this week, so this may take a little time. But we will eventually get there. |
48c8ec0 to
5594b28
Compare
|
You should stop force-push. It will make it difficult to review your changes. |
|
Conflicts appear again |
Add https://github.com/tats-u/goldmark-cjk-friendly extension which enhances handling of CJK emphasis and strikethrough.
Fixes #14114