srid/neuron

Bring back org support

JonathanReeve opened this issue · 5 comments

So I know org support has been removed in v2, but it seems to me that there are a lot of great reasons for supporting org-roam file formats in Neuron:

  • Org-roam has a large user base already, and so Neuron would get a lot of users, too, if it supported org-roam format.
  • Org-roam doesn't yet have a killer HTML exporter, in my opinion. There are hacky versions out there: @jethrokuan's brain dump, and @rasendubi's org-braindump, but @jethrokuan's approach converts all org files to Markdown in order to serve them with Hugo, which seems a bit excessive, and @rasendubi's approach is a brand new org-mode parser in Typescript.
  • Neuron v1 (and early v2?) is already really close to supporting org-roam files, already, since Pandoc has a built-in Org parser, and there's an Org reader here, even though it's not very complete.
  • I just really like the Haskell / Neuron and Rib / Reflex approach to static site publishing.

So I started adding some stub functions here on my fork. Any help there, either from org-roam contributors or neuron contributors, would be much appreciated, since I'm still fairly new to Haskell.

srid commented

To add back org-mode support in neuron, I'd recommend checking out the Plugin system in master branch. Support for other text formats is best added as a plugin. Part of this will involve figuring out how to best abstract out (without compromising neuron core's simplicity) the various places where Markdown-assumption is used (eg: when checking for .md file extension).

Plugins are defined here: https://github.com/srid/neuron/tree/master/neuron/src/lib/Neuron/Plugin ... a plugin is just a set of hooks, telling neuron to do custom things at various stage of the build process.

However, the Plugin type itself is hardcoded to assume markdown format (see for example the _plugin_markdownSpec hook). So we have to figure out a way to treat source formats polymorphically in the plugin type.

srid commented

Okay, I did some WIP prototype, and realized that org-mode support can be done as builtin -- doesn't have to happen as a plugin ... however we have to think in terms of how it impacts existing plugins.

For eg., the tags plugin requires YAML metadata, but org files have no YAML metadata, and instead they pass their heading properties in Pandoc AST. So the org reader can manually build a YAML structure out of these properties. This way, the plugins can continue to function independently of zettel formats in use (except for the aforementioned _plugin_markdownSpec, which may have to be refactored out).

srid commented

Real-world neuron notebook using .org files: https://github.com/Nimor111/notebook

Use this for testing the PR for this work.

srid commented

See https://neuron.zettel.page/next - but I'll make an exception for this one feature if anybody wants to open a PR. It will be in neuron for eternity.

srid commented

Emanote now supports Org Mode: https://emanote.srid.ca/demo/orgmode