Incorrect highlighting of bold and italic texts for .md files
Please consider making a Pull Request if you are capable of doing so.
App Version: 2025.1.3
Affected Device(s): Samsung Galaxy A54
Describe the bug In monokai theme bold (example) and italic (example) texts are highlighted incorrectly
To Reproduce Steps to reproduce the behavior:
- Choose monokai theme (Settings -> Application -> Color Scheme -> Monokai)
- Create an .md file
- Write text1, text2
Expected behavior
- text1 is bold
- text2 is italic
Actual behavior
- only the first ** is bold (the whole text1 must be bold)
- only the first * is italic (the whole text2 must be italic)
Screenshot
See brother and test below
Additional info
Btw in any other theme there is no highlighting of bold and italic texts at all. Dunno if that's intended or not
Response from ChatGPT (might be helpful)
You’re seeing the classic “only the delimiter gets colored” problem: the Markdown grammar emits two different kinds of tokens—the asterisks/underscores themselves (e.g. punctuation.definition.bold.markdown) and the content (e.g. markup.bold / markup.italic, sometimes markup.strong / markup.emphasis). Sora/EditorKit uses TextMate grammars under the hood, so your theme has to map those scopes explicitly; otherwise the delimiters win and the word in between stays unstyled. project-sora.github.io
Below is a minimal fix you can paste at the end of your tokenColors array so it has highest precedence among equal-specificity rules (TextMate theming rules are specificity-first; if equal, last rule wins). It does three things:
- Styles the content of bold/italic (both the generic and Markdown-specific aliases).
- Ensures the delimiters (the * / _) don’t steal the spotlight.
- Covers grammars that use strong/emphasis instead of bold/italic.
(Feel free to tweak the colors; I kept your palette.)
{
"name": "Markdown emphasis — content",
"scope": [
"markup.bold",
"markup.bold.markdown",
"markup.strong",
"markup.strong.markdown",
"markup.italic",
"markup.italic.markdown",
"markup.emphasis",
"markup.emphasis.markdown"
],
"settings": {
"foreground": "#66D9EF", // matches your "Markup Styling"
"fontStyle": "" // leave empty so bold/italic rules below control weight/style
}
},
{
"name": "Markdown emphasis — punctuation (delimiters)",
"scope": [
"punctuation.definition.bold.markdown",
"punctuation.definition.bold.begin.markdown",
"punctuation.definition.bold.end.markdown",
"punctuation.definition.italic.markdown",
"punctuation.definition.italic.begin.markdown",
"punctuation.definition.italic.end.markdown"
],
"settings": {
"foreground": "#FDFFF2" // or "#ABAFA8" to dim the asterisks/underscores
}
},
{
"name": "Markdown Bold (content)",
"scope": [
"markup.bold",
"markup.bold.markdown",
"markup.strong",
"markup.strong.markdown"
],
"settings": {
"fontStyle": "bold"
}
},
{
"name": "Markdown Italic (content)",
"scope": [
"markup.italic",
"markup.italic.markdown",
"markup.emphasis",
"markup.emphasis.markdown"
],
"settings": {
"fontStyle": "italic"
}
}
Why this works
- The built-in Markdown grammar (the one VS Code ships and most ports use) really does emit markup.* for the content and punctuation.definition.*.markdown for the */_ delimiters, so you need to style both sets. GitHub
- Theme precedence is scope specificity first; when specificity ties, the later rule wins—so appending these rules is important. Visual Studio Code +1
- Sora Editor’s TextMate module reads those scopes and applies your theme rules, so covering the right scopes fixes it in Squircle CE. project-sora.github.io
A couple of extra notes
- You already have:
- "Markup Styling" → markup.bold, markup.italic (color only)
- "Markdown Bold" → markup.bold.markdown (fontStyle only)
- "Markdown Emphasis" → markup.italic.markdown (fontStyle only)
These don’t catch markup.strong/markup.emphasis and don’t control delimiter color—hence the odd “only the first *” coloring you noticed.
- If, after this change, the text still doesn’t color, it likely means the Markdown grammar in your build isn’t emitting the expected scopes. In that case, bump the TextMate Markdown grammar (the project Microsoft maintains) or the language-textmate version used by Squircle CE. GitHub Maven Repository
Suggested PR blurb
Fix Monokai Markdown emphasis: style content of bold / italic (and strong/emphasis aliases) and de-emphasize punctuation delimiters. Places rules at end of token list to win ties in scope precedence.
And here's the monokai theme location: https://github.com/massivemadness/Squircle-CE/blob/master/feature-themes/impl/src/main/assets/themes/monokai.json