xmlsyntax-highlightinggeditgtksourceview

syntax highlighting gtksourceview, use another xml file?


We can add our language definition in gedit in a XML fileformat, in the /usr/share/gtksourceview-3.0/language-specs/ folder, But can we in our XML refere to an other XML file? In my language definition i want to add some script (C , Python , Java...) when they are between some special character, since they already have a XML file that i juste want to use it.

Anyone have a clue on achieving this?

https://developer.gnome.org/gtksourceview/stable/lang-tutorial.html


Solution

  • It's done here, for example, by namespacing the name of the context that you want to refer to with the language name: https://github.com/GNOME/gtksourceview/blob/0fdbdfb7d669f2726a9de548fcdeffcd68f5c0a1/data/language-specs/m4.lang#L998

    This includes the syntax definitions for shell code into some contexts in M4/Autoconf highlighting.