ox-hugo currently supports the following syntax for latex equations:
- https://orgmode.org/manual/LaTeX-fragments.html
- https://ox-hugo.scripter.co/doc/equations
This syntax is supported by mathjax as is mentioned in the ox-hugo documentation.
But quartz uses remark-math which has some issues with the \( \) syntax.
See https://github.com/remarkjs/remark-math/issues/39
This change adds few more transformations to the OxHugoFlavouredMarkdown
plugin, which makes a best effort conversion of this syntax into what
the Quartz Latex transformer plugin supports.
With these changes, the generated files show latex formatting with
default quartz configuration.
Sidenote on `\_` escape by ox-hugo:
ox-hugo escapes, _ using \_, we match against it after we transform
equations into what quartz supports($$ and $).
This could be achieved using lookaround like regex as follows
```js
(?<=(\$|\$\$)[\s\S]*) -> Positive lookbehind for $ or $$
\\_ -> Matches \_
(?=[\s\S]*(?:\1)) Positive lookahead for $ or $$ if matched
const escapedUnderscoreRegex = new RegExp(/(?<=(\$|\$\$)[\s\S]*)\\_(?=[\s\S]*(?:\1))/, "g")
````
But since lookahead/behind can slow things down on large files, we just
look up all equations with $ and $$ delimiters and then try replacing \_
* enhancement: support kebab-case and nested tags in ofm transformer
* update regex/capture groups to allow for (arbitrarily) nested values and tags of only -/_
* Update quartz/plugins/transformers/ofm.ts
---------
Co-authored-by: Jacky Zhao <j.zhao2k19@gmail.com>
* feat(plugins): add OxHugoFlavouredMarkdown
ox-hugo is an org exporter backend that exports org files to
hugo-compatible markdown in an opinionated way. This plugin adds some
tweaks to the generated markdown to make it compatible with quartz but
the list of changes applied it is not extensive.
In the future however, we could leapfrog ox-hugo altogether and
create a quartz site directly out of org-roam files. That way we won't
have to do all the ritual dancing that this plugin has to perform.
See https://github.com/k2052/org-to-markdown
* fix: add toml to remarkFrontmatter configuration
* docs: add docs for OxHugoFlavouredMarkdown
* fixup! docs: add docs for OxHugoFlavouredMarkdown
* feat(plugins): add toml support for frontmatter
Currently frontmatter is expected to be yaml, with delimiter set to
"---". This might not always be the case, for example ox-hugo(a hugo
exporter for org-mode files) exports in toml format with the delimiter
set to "+++" by default.
With this change, the users will be able use frontmatter plugin to
support this toml frontmatter format.
Example usage: `Plugin.FrontMatter({delims: "+++", language: 'toml'})`
- [0] https://ox-hugo.scripter.co/doc/org-meta-data-to-hugo-front-matter/
* fixup! feat(plugins): add toml support for frontmatter