Currently, highlight.js tries to autodetect languages, and in some cases fails.
This is a work in progress
This currently works to override .spec and .patch files (with that extension specifically) so that highlighter is used on those files.
Not sure about the approach here, but this works, and @pingou if you have any feedback, that would be awesome
We can simplify this:
override_rules = pagure_config.get("SYNTAX_ALIAS_OVERRIDES", {".spec":"specfile", ".patch":"diff"})
We'll also need to document this configuration key in the doc
rebased onto c792e7c514beee48528e0d02177f5bd3a795bf8f
rebased onto e7a1a4b35385f7389752bdbc6e6605d27250515e
We can simplify this: override_rules = pagure_config.get("SYNTAX_ALIAS_OVERRIDES", {".spec":"specfile", ".patch":"diff"}) We'll also need to document this configuration key in the doc
We can simplify this: override_rules = pagure_config.get("SYNTAX_ALIAS_OVERRIDES", {".spec":"specfile", ".patch":"diff"})
Yeah was tossing up if we wanted this as a config key or not, and do we want it olny as a key? or do a default hardcoded like i already have?
I don't know if it's a good idea to expose this as a configurable thing. Usually these override rules would be generally applicable anyway, so we'd want to incorporate those changes to all Pagure instances everywhere.
the main reason why it would be good configurable, is that sometimes filename extensions mean different things. this would allow configuration here rather than having it hardcoded in pagure itself.
I kept it in purpose as I think there will be case where we want to adjust the highlighting without touching the code base, one example is https://pagure.io/pagure/issue/3514 and the .fmf files.
.fmf
rebased onto e9f97393c68a36d433d0a5f46addc0bf785fb1b1
Outside of fixing the commit message, anything planned for this PR ?
@ryanlerch ?
rebased onto d26e95fcbd0ae2b33c63b2b9da2bc1da7c233028
rebased onto 2f670bd86d5b17e606ffe7b3ee444394060ed42d
rebased onto 9e130a27327b03047be20b81d2e2ada837a83074
rebased onto 146ae6fb6bdb582c56ae7084d8ebd9e2f68ea5df
I believe this is also ready for a review :)
ping for a review?
:thumbsup:
rebased onto 9fe1c6daefd41598759173d67397376978998251
Thanks for the review :)
Pull-Request has been merged by pingou
Currently, highlight.js tries to autodetect languages, and in some cases fails.
This is a work in progress
This currently works to override .spec and .patch files (with that extension specifically) so that highlighter is used on those files.
Not sure about the approach here, but this works, and @pingou if you have any feedback, that would be awesome