Missing Stata syntax highlighting in Live Preview / Source Mode

Steps to reproduce

  1. Create a new note or open an existing note in Obsidian.

  2. Insert a code block and specify stata as the language tag.

  3. Type some standard Stata code inside the code block (e.g., sysuse auto, clear, summarize).

  4. Switch the view to Source mode or Live Preview and observe the code highlighting.

  5. Switch the view to Reading view and observe the code highlighting.

Did you follow the troubleshooting guide? [Y/N]

[Y]

Expected result

The Stata code block should have proper syntax highlighting across all editing and viewing modes (Source mode, Live Preview, and Reading view).

Actual result

There is no syntax highlighting for Stata code in both Source mode and Live Preview. The syntax highlighting only works correctly when switched to Reading view.

Environment

SYSTEM INFO:
	Obsidian version: 1.12.5
	Installer version: 1.10.6
	Operating system: Darwin Kernel Version 25.3.0: Wed Jan 28 20:56:34 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T8122 25.3.0
	Login status: logged in
	Language: en
	Catalyst license: insider
	Insider build toggle: on
	Live preview: on
	Base theme: adapt to system
	Community theme: none
	Snippets enabled: 0
	Restricted mode: off
	Plugins installed: 0
	Plugins enabled: 0

RECOMMENDATIONS:
	none


Additional information

sample code





* 1. 提取并统一家庭层面的户主ID (解决非受访者 a1003a 缺失的问题)
bysort hhid: egen head_pline = max(a1003a)

* 2. 生成确定户主的虚拟变量
head_pline,则认定其为该家庭的户主
gen is_head = 0
replace is_head = 1 if pline == head_pline

* 3. 规范变量标签(可选操作,养成良好数据清理习惯)
label variable is_head "是否为户主 (1=是, 0=否)"

* 附:如果你还需要识别受访者,可以结合 A2001 进行生成
gen is_respondent = 0
replace is_respondent = 1 if a2001 == 1
label variable is_respondent "是否为受访者 (1=是, 0=否)"

live preview

reading view

https://help.obsidian.md/syntax#Code+blocks

It seems the editor (source mode and live preview) doesn’t support stata.


You could try this community plugin to see if it supports it:

Thank you so much for the detailed explanation! That makes perfect sense why stata isn’t highlighting properly in Live Preview/Source mode. I’ll definitely check out the community plugin you suggested.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.