Issue #6855 new

Custom code highlighting (BB-8029)

Karsten Becker
created an issue

At https://bitbucket.org/kbecker/pshdl/wiki/tutorial I want to document my own programming language. Unfortunately I can not get any useful syntax highlighting done. The problem is that if I don't specify any language, it is guessed. This means that something wrong is guessed as this language is not known to pygments yet. Unfortunately I also can not create my own <pre> blocks or other formatting options like span. It would be awesome to:

  • attach custom CSS and styles to code
  • disable the automatic language guessing

Karsten

Comments (2)

  1. Karsten Becker reporter

    Btw. I was able to use #!text as indicator to at least get the guessing off.

    As you probably don't want to have any JavaScript or CSS embedded into the Wiki by the user, here is an idea on how to solve that problem:

    Let the user create a custom tag like: #!custom:pshdl In the account setting the user than can specify a set of regular expressions and define their color and font style. For example for PSHDL that would be /^\b(?:bool|uint|int|string|bit)\b/i -> color: rgb(205, 43, 62); /^\b0x[01_]+/i -> color: rgb(80, 80, 90); font-weight: bold;

    This would already help tremendously and should be reasonably possible to implement with pygments.

  2. Log in to comment