New plugin: Orgmode CM6

Introducing Orgmode CM6, my first obsidian plugin that allows to view/edit orgmode files (*.org), as opposed to markdown files (*.md). I am using it on desktop for my orgmode files coming from my phone with orgzly.

I was previously using obsidian-org-mode and wanted to customize the experience with some JS/CSS but was frustrated that it was using code mirror 5 like the legacy editor (feature removed in obsidian 1.5) and not code mirror 6 like current obsidian. So I wrote this plugin from scratch to do just that (CM6 is for code mirror 6), and a little more:

  • The syntax highlighting is not based on regexes but on a custom lezer grammar so it is much more accurate, even though not all orgmode syntax is implemented.
  • There are CSS classes to customize the syntax highlighting.
  • You can define your own todo/done keywords for the syntax highlighting.

Still not a fully-featured orgmode editor, but I hope it can be useful.

I would love to have your feedback about the plugin. I am also curious to know more about your orgmode/obsidian workflows, if you are into that.


I was hoping that someone would be brave enough to do this. Thank you so very much!

I’ll try out the plugin this weekend.

Initially when I was at least contemplating the idea of doing it myself, I looked at Lezer (nice idea like tree-sitter), but then I saw that CM6’s markdown mode was NOT done with lezer, I think due to its flexibility which supports a.o. embedded code blocks that also need to be correctly parsed. Does your parser support code blocks?

Thank you.

By CM6’s markdown mode, are you talking about @codemirror/lang-markdown which uses @lezer/markdown? It was done with lezer, just not using a grammar file. Markdown and Orgmode are similar in that their grammars are not context-free and cannot be expressed as a LR parser, but there are ways to implement them with Lezer.

My parser relies on external tokens. It doesn’t currently support code blocks, but there is no fundamental reason it couldn’t be implemented. CodeMirror and Lezer call this feature Mixed-Language Parsing.

Is that a feature you would be interested to use, or do you just want to know what is possible?

Hi @bbazard , I want to use this plugin on iPhone, is it possible?


This plugin was not implemented on mobile. I never tried it on iOS but I tried it once on android and it didn’t work.

I am guessing some configuration is needed to make obsidian handle *.org files.
Since I don’t use obsidian on mobile, I didn’t look at how to make it work.

You can disable a flag in the manifest.json in your .obsidian to activate the plugin on mobile as described in Hacking Obsidian: Making a Desktop-only Plugin Work on your Phone or Tablet | Medium but it will probably still not work.

New version 2.0.0 available :tada:

  • The plugin now works on android and iOS
  • The orgmode files are now auto-saved
  • Experimental CodeBlockProcessor to see orgmode tasks in markdown files

See the details and a video of the experimental feature: Release 2.0.0 · BBazard/obsidian-orgmode-cm6 · GitHub

With version 2.1.0 there is now support for text markup like bold and italic.


1 Like

Now with Live Preview

Support for orgmode links

  • urls [[][text]]
  • files inside the vault [[]]
  • inline images [[image.png]]

Text markup markers are hidden.


Video available in the Release 2.2.0 · BBazard/obsidian-orgmode-cm6 · GitHub

1 Like

Plugin broken: not anymore

Vim mode was accidentally enabled, causing the editor to misbehave (if you don’t expect vim).
Someone opened an issue on github about it and that’s how I discovered it.

Vim mode now follows the obsidian vim setting (restart obsidian if you decide to change the obsidian vim setting).

Thanks for making this! I’ll have to check it out. My workaround making my files .md but including at the top

-*- mode: org; -*-

so that emacs opened the appropriate mode but the files were available later on other devices via obsidian.
Thanks again!

1 Like

Hi there! Should header folding work on iPhone? All other features working for me except that.

An awesome step would be supporting org roam ID: links…


I don’t have an iPhone to test it but yes it should work.

You have to tap on the left margin (the gutter) on the line of the heading, if the heading doesn’t contain any section or nested headings you cannot fold it. The fold marker is only visible after the heading is folded.

Can you tell me what are org roam ID: links? I don’t know org roam.

oh wow you’re right - it does work! a quick observation and suggestion:
when I first open an org file with foldable content, there are no visual cues that it can fold (hence my question). However - when I click the empty margin, the content folds, and I get the “folded” icon in the margin. when I click the “folded” icon, the content then unfolds, and I get an “unfolded” icon.
when an org file with foldable content loads - could it show the “unfolded” icon already?

re: ID links, they actually have nothing to do with roam, they are the fundamental org link structure:

:ID: abc
[[id:abc][My Link to Node abc]]

When the properties start the file, the ID is for the file itself and the link is to the file.

You can also of course add an ID property to any node, and link there directly, and link relatively to any child of an IDentified node using the :: syntax - but I’ll settle for just the first part for now!

I mentioned org-roam merely because that’s sometimes how ID links are created, but certainly not the only way.

Thanks for making such an awesome plugin!

I want to be consistent with obsidian for the foldable content. Looking again I see that I missed that the fold icon is always visible in obsidian when the cursor is inside the heading line. I believe it should solve the discoverability problem.

Concerning ID links, thank you for opening an issue about it. We can continue the discussion on github.