euler wrote:The syntax highlighter at PE has changed from a system based on google-code-prettify to highlight.js. It should be made clear that no system is perfect given the number of languages which members are using, but one of the reasons for the change is due to the number of complaints about the old system. I thought the old system was doing a reasonable job, but others didn't agree; in fairness it has not been updated for a number of years and it had limited support for differentl languages. In contrast, highlight.js is still being developed and currently supports 52 languages, even if a number of those are completely obscure.
To use code in the problem threads on the main website please wrap your script between
tags. To specify a particular language then you can use
- Code: Select all
, where X is the name of the language.
- Code: Select all
If you do not specify the language then the parser will use the language you have selected in your profile.
If you do not wish the parser to use the language specified in your profile then you can force auto-detect by using [code=?].
You can force the parser to not highlight a block of code at all by using an asterisk in the specified language. For example, [code=python*] or [code=*]. In the former case it will indicate that Python is the language on the clickable link at the top of the code box, but no highlighting will be applied to the code within.
As mentioned, currently the script supports 52 languages, but that may change in the future. If your profile language is set to X and you have posted a solution in a different language, Y, then you should specify that language: [code=Y], even if that language is not currently supported. It is generally recommended to not specify a language if the language you're posting is the same as your profile and that is not likely to change. Especially if you're doing that because your current language is not supported but you've found that language Z is a reasonable second best. You may come to regret forcing the parser to use a different language now because it looks reasonable when in the future after full support for your language has been added it would have looked perfect; after all you're not likely to go back and edit all your posts. If in doubt or you really hate the way it is rendering it currently then use [code=*] with every post and it will not highlight your scripts at all.
Users browsing this forum: No registered users and 2 guests