Loading repository data…
Loading repository data…
zhaoshenzhai / repository
An Obsidian.md plugin to render MathJax in your links.
An Obsidian.md plugin to render and manage MathJax in your links.
Associate a mathLink to your note, containing arbitrary MathJax, and have it displayed in all links to the note.
mathLinks.
Assigning a mathLink in the YAML frontmatter of note.md as shown below will make all links of the form [[note]] and [note](note.md) display as the rendered MathJax of yourMathLink. No changes are made to your notes, and updates to yourMathLink will be reflected (almost) instantaneously.
---
mathLink: yourMathLink
---
Content starts here.
This plugin also makes Wikilinks and Markdown Links compatible with MathJax, so links like [[note|yourAlias]] and [yourAlias](note.md) will be displayed as the rendered MathJax of yourAlias. A mathLink in note, if present, will be overridden by yourAlias.
Additionally, Obsidian also supports links to blocks [[note#^block-id]] and headings like [[note#section]]. Any MathJax in #section will be rendered (both in the note and in the Outline view), and you can associate a mathLink to ^block-id as well by adding a YAML frontmatter like so:
---
mathLink-blocks:
block-id: yourMathLink
---
Oftentimes, mathLinks of notes involve replacing some text with its math counterpart. For instance, you might have many notes whose title is of the form ... iff ....
Instead of setting the mathLinks of each note manually as ... $\Leftrightarrow$ ..., simply use mathLink: auto. This will generate its mathLink via a template that replaces iff with $\Leftrightarrow$. A template consists of a string to be matched (iff), its replacement ($\Leftrightarrow$), and some options (global match, case sensitive, and match whole words). They are created and maintained in the MathLinks settings window.
Each template has the following options, which can be configured when the template is created/edited.
| Field | Description | Default |
|---|---|---|
| Match for | String to be matched and replaced. Do not include regex. | |
| Replace with | String to replace matches. Do not escape backslashes. | |
| Global match | Match all instances (instead of just the first). | true |
| Case sensitive | Matches will be case sensitive. | true |
| Match whole words | Only match whole words. | true |
MathLinks will ignore those files. If a directory is selected, all files under that directory will be ignored.
MathLinks supports links to blocks and headings like [[note#^block-id]] and [[note#section]]. You can modify how they are rendered by:
^. This can be changed (or removed).note: If disabled, the links will be rendered as [[^block-id]] and [[section]].Enable MathLinks in Source Mode (Default: false). Currently, only Wikilinks are supported.
MathLinks exposes an API, allowing other community plugins to utilize its powerful "dynamic aliases" feature. You can find more information and a simple sample plugin at this repo: https://github.com/RyotaUshio/obsidian-mathlinks-api-sample-plugin.
If you would like to point out a bug, add support, or have a feature request, don't hesitate to open an issue/pull request! Thank you to all who have contributed.
update() API function had no effect in Editing view (#59).0.4.2 no longer prevents dynamic updating (#35, #36).npm package (#33, ).cmd key and mouse); proper Dataview rendering in callouts (#17, #18, #19, #20).ctrl is held (#16).mathLinks in live-preview, which should now render in most markdown elements. Made the ViewPlugin operate independently from each leaf, which now allows for multiple instances of the same file to be opened and rendered differently in live-preview and source (#12, #15).mathLinks in Dataview inline fields (#13, #14).layout-changed for pinned notes (#10, #11).mathLinks in live-preview (#7).mathLinks in canvas (#6).UTf-8 characters in fileName (#3).fileManager.getNewFileParent() (#1).getMathLink().$...$) and patches them back together.this.app.vault.configDir instead of .obsidian.Use [[Wikilinks]] is disabled. Instead, revert back to its Markdown Link.