noteworthy icon indicating copy to clipboard operation
noteworthy copied to clipboard

Support Common Markdown Variants

Open benrbray opened this issue 3 years ago • 6 comments

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.

  • tables, insertions/deletions, references, glossary, superscripts/subscripts
  • extended syntax for image sizes etc
  • transclusions, metadata, etc

Related to #2.

benrbray avatar Apr 01 '21 11:04 benrbray

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       : [email protected]
Logo        : False
Embed       : False

benrbray avatar Apr 06 '21 08:04 benrbray

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 avatar Apr 07 '21 03:04 benrbray

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 avatar Apr 08 '23 01:04 benrbray

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).

benrbray avatar Apr 12 '23 04:04 benrbray

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:

manunamz avatar Jun 10 '23 15:06 manunamz

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.

  • the user should be able to assign a name (obsidian or gfm etc) to a particular collection of syntax extensions
  • by adding a field flavor: obsidian to the frontmatter, Noteworthy should automatically parse/serialize that file in an Obsidian-compatible way

benrbray avatar Jun 10 '23 23:06 benrbray