I am developing a package which has it’s own settings view (as I want to do a little more than the standard settings provide). In this view I have a list of snippets for different languages. The snippets are wrapped in a
<code></code> element and now I want them to be highlighted in the respective language.
I’ve found out that the Atom styleguide view (
Packages -> Styleguide -> Show) uses CSS classes like
.show-example-html .editor-colors.example-html to support highlighting but I can’t figure how this is done.
I looked into the code on Github, and it looks like it uses the core function
require('space-pen') but I can’t go further than that.
I also took a look into the atom-minimap package, which supports code highlighting. It looks like they use a buffer and then call
getGrammar() on it, but how should this work with custom code snippets on a custom view?
I am a bit lost at this point and don’t know in which direction I should head or what else to do.
Edit: Or should I use the
<atom-text-editor> element? Adding
readonly attributes doesn’t work, as it is a custom element. Is it possible to make it read only?