Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Common Markdown Variants #8

Open
benrbray opened this issue Apr 1, 2021 · 6 comments
Open

Support Common Markdown Variants #8

benrbray opened this issue Apr 1, 2021 · 6 comments
Labels
enhancement New feature or request low-priority

Comments

@benrbray
Copy link
Owner

benrbray commented Apr 1, 2021

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 benrbray added enhancement New feature or request low-priority labels Apr 1, 2021
@benrbray benrbray changed the title Support MathPix Markdown and MultiMarkdown Support Common Markdown Variants Apr 6, 2021
@benrbray
Copy link
Owner Author

benrbray commented Apr 6, 2021

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
Copy link
Owner Author

benrbray commented Apr 7, 2021

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
Copy link
Owner Author

benrbray commented Apr 8, 2023

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
Copy link
Owner Author

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
Copy link

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
Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request low-priority
Projects
None yet
Development

No branches or pull requests

2 participants