benrbray / noteworthy

Markdown editor with bidirectional links and excellent math support, powered by ProseMirror. (In Development!)
https://noteworthy.ink
GNU Affero General Public License v3.0
230 stars 13 forks source link

Support Common Markdown Variants #8

Open benrbray opened 3 years ago

benrbray commented 3 years ago

Consider adding support for common Markdown variants to Noteworthy.

MathPix Markdown ("LaTeX-flavored markdown")

The MathPix OCR tool is also associated with a file format called MathPix Markdown (.mmd or mdl extension). There is a corresponding mathpix-markdown-it plugin, a vscode plugin, and a web editor.

The added LaTeX syntax and corresponding markdown-it parsers for \begin{equation}...\end{equation} blocks are appealing. See the syntax reference.

Mathpix Markdown is a superset of Markdown that adds helpful syntax for the STEM community, such as advanced equation, table, and chemistry support. Wherever possible, we borrow syntax from LaTeX. In other cases (such as chemistry) we invent new syntax that is backward compatible with Markdown.

Here are the key benefits over plain Markdown:

  • better equation support via LaTeX syntax (powered by MathJax), including equation numbering and referencing conventions from LaTeX
  • better support for tables, via the LaTeX tabular syntax, which allows for complex, nested tables often seen in scientific publications
  • advanced figure referencing via LaTeX syntax
  • support for abstracts, author lists, and linkable sections; these are a fact of life for academic publications
  • support for chemistry diagrams represented with SMILES markup, compatible with popular chemistry tools like Chemdraw

MultiMarkdown

MultiMarkdown standardizes some common extensions to the usual markdown syntax. See the syntax reference.

Related to #2.

benrbray commented 3 years ago

Madoko Markdown

Madoko Markdown is a LaTeX-flavored Markdown aimed at researchers and mathematicians.

Trivia: The Madoko Editor is written in the Koka programming language!

Here are some snippets from the reference manual that showcase interesting syntax. There is a nice syntax for metadata / entity names that might be worth emulating in Noteworthy.

### A named heading { #myheading }

And we can refer to it

* Using an explicit [link](#myheading) 
    (or [reference][#myheading]).
* Or using an implicit link to Section [#myheading].
* Or we can just see its label, namely &myheading;.
A famous equation is $E = mc^2$, but another famous one is:
~ Equation  {#eq-gaussian; caption:"The Gaussian equation" }
 \int_{-\infty}^\infty e^{-a x^2} d x = \sqrt{\frac{\pi}{a}} 
~
and we can refer to Equation [#eq-gaussian] like any heading.
Table [#tab-sample] shows an example table figure.

~ TableFigure { #tab-sample; \
    caption: "Modelle mit unterschiedlich geschätztem baseline hazard"; }
|                 | $c(t)$                                         ||||
|                 |---------|---------|---------|---------------------|
|                 | (A0)    | (A1)    | (A2)    | (A3)                |
|                 | ohne    | Log     | Polynom | Stückweise konstant |
|:----------------|:-------:|:-------:|:-------:|:-------------------:|
| Log likelihood  | -6.798  | -6.733  | -6.715  | -6.686              |
| Pseudeo $R^{2}$ | 0,048   | 0,057   | 0,059   | -                   |
| AIC             | 13.615  | 13.489  | 13.456  | 13.483              |
| BIC             | 13.711  | 13.594  | 13.580  | 14.009              |
| N               | 105.484 | 105.484 | 105.484 | 105.484             |
|-----------------|---------|---------|---------|---------------------|
{ .booktable }
~
~ Begin Columns
~ Column { width:40% }
Here is a long paragraph.
Here is a long paragraph.
Here is a long paragraph.
Here is a long paragraph.
Here is a long paragraph.
Here is a long paragraph.
Here is a long paragraph.
~
~ Column
A butterfly ![bfly]
~
~ Column { width:5em}
~~ Center
$e = mc^2$.
~~
~
~ End Columns
A Haskell keyword like `instance`{language:haskell} can be highlighted inline.

If you use a particular language a lot in your document, you may want to set it as the default language using a metadata rule. For example:

pre,code {
  language: JavaScript;
}

Metadata must come immediately as the first thing in a document, and consists of keys followed by a colon and then the key value. A key value can span multiple lines by indenting, and you can leave blank lines between different keys. In general, metadata keys are not case-sensitive. The values none, clear, false, and the empty value are all equivalent for boolean or numeric keys.

Title       : An overview of Madoko
Author      : Daan Leijen
Affiliation : Microsoft Research
Email       : daan@microsoft.com
Logo        : False
Embed       : False
benrbray commented 3 years ago

Maruku Markdown

Maruku is a pure-Ruby Markdown-superset interpreter. See the Maruku syntax reference. Some of its syntax choices are quite similar to Madoko. Maruku is used to generate pages for ncatlab.

benrbray commented 1 year ago

Noteworthy aims to play nicely with other Markdown editors, so I hope to one day add a preferences menu that allows users to toggle on/off the parsers & editing components for specific syntax they wish to support (or not). For example, including the following YAML metadata would tell Noteworthy to use only the syntax extensions related to GitHub-Flavored Markdown:

---
flavor: github
---
benrbray commented 1 year ago

Obsidian Markdown

Obsidian seems to be rather idiosyncratic and diverges from CommonMark in a few important ways, including:

Obsidian Image Syntax

For some reason, Obsidian saves image references using ![[image.png] syntax instead of the standard ![label](image.png) syntax from CommonMark. This makes it hard to use Noteworthy to read files produced by Osidian (unless the Obsidian user explicitly chose to export their files).

manunamz commented 1 year ago

re: Obsidian Image Syntax

On the off-chance you want a plug'n'play (perhaps togglable) solution to this, there are many existing remark plugins that try to capture Obsidian syntax:

benrbray commented 1 year ago

plug'n'play (perhaps togglable)

Thanks for the links, indeed that is my goal. I want syntax extensions to be individually toggle-able, so that Noteworthy can be configured to read Markdown produced by any editor.