quartz-research-note/docs
Hrishikesh Barman 2f99339dcf
feat: add transformations for latex in oxhugofm (#510)
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 \_
2023-09-29 11:35:26 -07:00
..
advanced feat: display name for folders, expand explorer a little bit (#489) 2023-09-20 16:08:54 -07:00
features feat: add transformations for latex in oxhugofm (#510) 2023-09-29 11:35:26 -07:00
images Fix #403 by moving documentation to separate directory to avoid merge conflicts (#405) 2023-08-23 12:09:04 -07:00
tags Fix #403 by moving documentation to separate directory to avoid merge conflicts (#405) 2023-08-23 12:09:04 -07:00
authoring content.md docs: fix typo in authoring content.md (#408) 2023-08-24 08:14:52 -07:00
build.md Fix #403 by moving documentation to separate directory to avoid merge conflicts (#405) 2023-08-23 12:09:04 -07:00
configuration.md Revert "feat: Making Quartz available offline by making it a PWA (#465)" 2023-09-20 13:52:45 -07:00
hosting.md docs: update hosting.md with Vercel hosting instructions (#406) 2023-08-23 15:14:23 -07:00
index.md Revert "feat: Making Quartz available offline by making it a PWA (#465)" 2023-09-20 13:52:45 -07:00
layout.md Fix #403 by moving documentation to separate directory to avoid merge conflicts (#405) 2023-08-23 12:09:04 -07:00
migrating from Quartz 3.md Fix #403 by moving documentation to separate directory to avoid merge conflicts (#405) 2023-08-23 12:09:04 -07:00
philosophy.md Fix #403 by moving documentation to separate directory to avoid merge conflicts (#405) 2023-08-23 12:09:04 -07:00
showcase.md add site to showcase (#504) 2023-09-24 10:27:42 -07:00
upgrading.md Fix #403 by moving documentation to separate directory to avoid merge conflicts (#405) 2023-08-23 12:09:04 -07:00