GTKSourceView Syntax Highlighting different colours for layers of brackets (like VSCode) - syntax

VSCode
In VSCode (and probably other editors too) when you have brackets within brackets, the colour will change, this doesn't happen in GTK editors like Mousepad and Gedit. I know how to add syntax rules to GTKSourceView programs by editing the *language*.lang files, and I have got it working like this:
What I have so far
I have the text different colours depending if it is in brackets, however, it's highlighting all the text, instead of just the brackets. How can you get it to highlight only the brackets, but still highlight other brackets within those differently?
Code I have to do what the image shows:
<context id="testing1" end-at-line-end="true" style-ref="testing1">
<start>\(</start>
<end>\)</end>
<include>
<context id="testing2" style-ref="testing2">
<start>\(</start>
<end>\)</end>
</context>
</include>
</context>

Related

How can I colour my code?

A student in another class coloured their code in their word document, I asked my teacher if he knew how and he suggested he coloured it all by hand... I'm very sure he didn't colour hundreds of lines of code by hand.
I've also seen many websites that colour the code snippets to help with readability - including StackOverflow!
Here's a print screen of the code contained in the word document.
as you can see they're not print-screens as not only can I highlight the text, word has underlined what it thinks are errors in spelling / grammar.
When you copy-paste into a Word document, it (by default) retains the formatting of the text copied into it. IDEs (e.g., Visual Studio, Eclipse, IntelliJ, etc.) usually perform syntax highlighting (i.e., color different elements of the code differently in order to highlight their purpose) for you. If you copy and paste from the IDE you've used to create the code, it will probably retain this formatting.

Correcting Syntax Highlight files for Notepad++

I was trying to add a syntax highlight file to Notepad++ containing syntax highlights for AutoHotkey, I followed what was in this here https://autohotkey.com/boards/viewtopic.php?f=7&t=50
but of course when I've imported it and set the defined language thing, it gives me wrong colors all over the text making white background around the text like this
How can I correct this so it's giving me the proper syntax highlights without white background on the text? it looks horrible just looking at it.
Right click the background color in the Styler Dialogs:
The transparency mark won't be remembered, but the style will.

text highlight in markdown

Within a Markdown editor I want to support text highlight, not in the sense of code highlighting, but the type of highlighting people do on books.
In code oriented sites people can use backquotes for a grey background, normally inline code within a paragraph. However on books there is the marker pen for normal text within a paragraph. That is the classical black text on yellow background.
Is there any syntax within Markdown (or its variants) to specify that the user want that type of highlight? I want to preserve the backquotes syntax for code related marking, but also want a way to enable highlighted user text
My first thought is just using double backquotes, since triple backquotes are reserved for code blocks. I am just wondering if other implementations have already decided a syntax for it... I would also appreciate if someone could justify if this is a very bad idea.
As the markdown documentation states, it is fine to use HTML if you need a feature that is not part of Markdown.
HTML5 supports
<mark>Marked text</mark>
Else you can use span as suggested by Rad Lexus
<span style="background-color: #FFFF00">Marked text</span>
I'm late to the party but it seems like a couple of markdown platforms (Quilt & iA Writer) are using a double equal to show highlighting.
==highlight==
Typora is also using double equal for highlighting. It would be nice it that becomes a CommonMark standard, as mentioned by DirtyF. It would be nice for those who use it frequently, since it is only 4 repeated chars: ==highlight==
If you want the option to use multiple editors, it may be best to stick with <mark>highlight</mark> for now, as answered by Matthias.
Here is the latest spec from CommonMark, "which attempts to specify Markdown syntax unambiguously". Currently "highlighting" is not included.
Editors using ==highlight== from comments mentioned previously:
Typora
Obsidian
Quilt
IA Writer
Feel free to add to this list.
You can use the Grave accent (backtick) ` to highlight text in markdown
Highlighted text
Also works with VS Code extension markdownlint
Grey-colored Higlighting Solution
A possible solution is to use the <code> element:
This solution works really well on git/github, because git/github doesn't allow css styling.
OBS!:
Using the code-element for highlighting is not semantic.
However, it is a possible solution for adding grey-colored highlighting to text in markdown.
Markdown/HTML
<code> <i>This text will be italic</i> <b>this text will be bold</b> </code>
Output
This text will be italic this text will be bold
Roam markdown uses double-caret: ^^highlight^^. Andrew Shell's answer mentions double-equals.
The accepted and clearly correct answer is <mark> from Matthias above, but I thought I had seen carets in some other flavor of markdown. Maybe not. I want to transform my ^^highlights^^ to <mark>highlights</mark> in pandoc conversion to html, and somehow ended up here...
Probably best bet is just use html e.g
<pre><b>Hello</b> is higlighted</pre>
Hello is higlighted
Remember nearly all html is valid in markdown too.

Using a non-default color shema for gedit syntax highlighter

I wrote a simple gedit xml lang file for do highlighting source code. When i use constructions like
<style id="comment" _name="Comment" map-to="def:comment"/>
<style id="keyword" _name="Keyword" map-to="def:keyword"/>
it always color comments blue and keywords brown. I would instead like my comments green and keywords red. How can I do that?
I also noticed some schemas under /usr/share/gtksourceview-2.0/styles:
classic.xml cobalt.xml kate.xml oblivion.xml styles.rng tango.xml
How can I use these in my lang file?
The lang files do not describe styles. The lang defines the language (this is a keyword, this is comment, etc.) and the style describes how to display those things (make comments green, make keywords blue and bold, etc.). It's up to the end user to choose the style based on there preferences.
You can select a style in the Gedit preferences dialog. As it happens, the "Kate" style does color comments green and keywords red, so you should use that one.
Take note that the paths for where you store the style and lang files is different in Gedit 2 and Gedit 3 (GTK+ 2 and GTK+ 3).

Syntax Highlighting for plain text (Sublime Text)

I am a great fan of syntax highlighting in any form. But i am missing something similar for plain text files. Imagine different colors for indented lines or lines preceded by special chars. Does anything like that already exist? I'd especially appreciate a plugin for Sublime Text.
The closest thing I know of is the PlainTasks plugin:
It's a plugin to make styled TODO lists, but what you see in the screenshot is basically it.
You could modify the Markdown or reStructuredText files to actually color the text.

Resources