question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Review available Markdown Syntax

See original GitHub issue

A list of markdown items that we should review in addition to discussions on Jmarkdown, RST support etc.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (11 by maintainers)

github_iconTop GitHub Comments

4reactions
choldgrafcommented, Jan 22, 2020

I’ve spent a little bit of time looking into Markdown flavors that might be of interest and wanted to update this issue with some more perspective.

First off, I think this is the main takeaway (it is a suggestion, not a directive): our build system should support a strict subset of Pandoc markdown or RMarkdown. It could do this in addition to another language like rST.

Why support Pandoc Markdown?

I spoke with a few folks at RStudio which is the main driver behind RMarkdown. This is the flavor of markdown supported by bookdown. It has proven resilient and quite popular in the R community, and supports many of the features that we’d need for publishing. RMarkdown is a subset of Pandoc markdown (here is a summary of pandoc markdown and here is the announcement that RMarkdown is a subset of pandoc markdown). This means that if we were to support the same subset of Pandoc Markdown, then we’d be supporting a language that is already utilized by a huge community of people.

How would we support this?

Here is a useful post with information on what we’d need to do to support this.

I think there are two options to supporting pandoc markdown.

  • First is to write a direct parser that goes from Pandoc markdown -> a docutils AST. This could be, for example, by building on top of the recommonmark project, which does this for the base “commonmark” flavor of markdown.
  • Second is to build a bridge between markdown and rST, such as the m2r package. This is also what nbsphinx does to support reading Jupyter notebooks.

In either case, we’d want to define a subset of Pandoc markdown syntax that we wish to support, and then create a mapping from that subset onto either docutils objects or rST. This could be a standalone Sphinx extension that would be really useful for the community outside of just this project.

As a side note, here’s an interesting post about the differences between pandoc MD vs rST

@chrisjsewell has already made a really interesting implementation of this approach here: https://github.com/ExecutableBookProject/meta/pull/12

A few caveats

There are a few potential pitfalls to this…here are some that I can think of:

What about directives and roles?

The biggest question to my mind is what to do about directives and roles (if we are using Sphinx under the hood). These are one of the most powerful features in Sphinx, and something we could take advantage of to extend new features for books. But, there are no native “directives and roles” features in markdown.

One idea would be to piggy-back on Pandoc markdown syntax for these.

Directives

In rST directives look like this:

.. mydirective:
   :myparam1: myval1
   :myparam2: myval2

In markdown, this might be utilized with Pandoc syntax. For example, Pandoc allows you to separate <div> elements with fences like so:

::: mydiv
# Some markdown
inside the div
:::

and optionally:

::: myotherdiv {.myattribute}
:::

Perhaps the pattern of ::: something could be mapped onto directives in rST. For example, something like:

::: toctree {maxdepth=1}
* page1
* page2
:::

Roles

For in-line markup, we could use the “bracketed spans” syntax from Pandoc markdown. This is intended to making custom “span” elements in your text like so:

[This is *some text*]{.class key="val"}

However, we could piggy-back on this by defining some specific roles, e.g.:

I'm now linking to a [different document]{doc=anotherPage} which contains [this equation]{eq=myeqID}. And also for [references]{ref=mybibtexref}. 

Curious what folks think about that…

I’ll update this issue if I can think of some other things to consider…

1reaction
choldgrafcommented, Feb 8, 2020

Was going through the CommonMark forums and found an interesting comment from JGM re: extension syntax in markdown: https://talk.commonmark.org/t/support-for-extension-token/2771/7

Read more comments on GitHub >

github_iconTop Results From Across the Web

Markdown Code Reviews - Code With Engineering Playbook
markdownlint is a linter for markdown that verifies Markdown syntax, and also enforces rules that make the text more readable. Markdownlint-cli is an...
Read more >
Using Markdown | Documentation - Review Board
Markdown supports both ordered (numbered) and unordered (bulleted) lists. These are written using a natural syntax. Ordered lists use numbers followed by ...
Read more >
Markdown Syntax Documentation - Daring Fireball
To this end, Markdown's syntax is comprised entirely of punctuation characters, which punctuation characters have been carefully chosen so as to look like...
Read more >
Supported Markdown syntax | Upsource - JetBrains
Upsource supports Markdown in review and discussion comments. Here is the syntax ... Task lists are available in version 2018.1 and higher.
Read more >
20+ Useful Markdown Syntaxes for Developers
Highlighting a code block is a much-needed feature for technical documentation and blogs. We have seen the syntax for the inline code previously ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found