I’m working on adding highlighting to code-blocks on lemmy using highlight.js, and am wondering exactly how to implement it. There are many code-themes that could be used Regarding which theme to use there are basically two different directions I could go:

  1. Each lemmy-theme would have to explicitly declare an hljs theme to use.
    • PROS:
      • easy to use, users automatically get an appropriate code-theme for every ui-theme.
      • simple to implement (already done)
    • CONS:
      • theme-makers need to pick an appropriate theme
      • no user customizability, limited number of themes
  2. Users can pick their preferred theme just like they pick a UI theme.
    • PROS:
      • Extreme customization, there are a buttload of themes, and users can pick any one!
    • CONS:
      • Users would need to pick an appropriate theme. It would use the “browser-default” (light/dark) until they pick one, and could look weird and be confusing until then
      • PITA to implement & requires back-end changes (wont see it for a while)

Let me know what you think, or if you have another solution.
I have solution #1 deployed on HeapOverflow.ml right now =]

Here is the PR for those interested: https://github.com/LemmyNet/lemmy-ui/pull/663

Everything about Lemmy; bugs, gripes, praises, and advocacy.

For discussion about the lemmy.ml instance, go to !meta@lemmy.ml.

  • 0 users online
  • 2 users / day
  • 5 users / week
  • 7 users / month
  • 8 users / 6 months
  • 1 subscriber
  • 40 Posts
  • Modlog