I want to use GtkSourceView with my custom syntax parser to highlight syntax of a custom markup language while supported languages should be parsed by GtkSourceView as usual. I prefer that my custom markup can use the GtkSourceView’s existing switchable themes/styles.
My custom syntax parser generates following parsing events upon buffer processing:
There are several reasons why I need to use a custom syntax parser rather than adding a new language definition to GtkSourceView. One of them - GtkSourceView’s parser has some limitations that do not allow my syntax to get recognized.
So what I’m actually asking about is the following:
Let’s assume I have this string in GtkSourceView buffer: This is a *bold* word. How should I mark *bold* so that it is displayed bold and once I change themes (as is currently possible in the Gnome Text Editor) - it’s style will be changed according to the theme (but remain bold of course)?..
The problem is - changing the theme doesn’t seem to change the theme of the text while it does change the background color. Here how 2 different theme look like in my window:
Note that gnome-text-editor default style is Adwaita (where “def:strong-emphasis” is black and italic) while the gtksourceview default style is Classic (where “def:strong-emphasis” is brown).
That’s why the initial style looks different, and will stay so until the tags are updated to the new one.
Now the last thing that remained is this: “Then you’ll have to create one GtkTextTag per “annot” kind, and map it to a style”. Since I’m new to GTK and GLib (should I use it?) - can you, please, suggest the best way to implement this map, giving 2-3 example map items… Preferably in C…