Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Markdown can simply be code - the fenced code blocks are quite enjoyable to work with. RMarkdown is this. Before I learned of RMarkdown I had written something to extract code blocks with filenames that are visible in the rendered page (since hiding it at the end of the first triple backquote codefence isn't great for visibility). I'm currently working on a JavaScript-centered notebook tool (rather than Python centered or R centered as two great ones are). https://github.com/ResourcesCo/macchiato/blob/main/scripts/m... https://github.com/ResourcesCo/notebook

Markdown nested lists could also be used as an alternative to JSON and YAML - they would appear as bullets in a rendered markdown file. I didn't know about this until I started experimenting but inline code blocks can contain backquotes just like fenced code blocks can contain triple backquotes, by wrapping them in a greater number of backquotes.



> Markdown can simply be code - the fenced code blocks are quite enjoyable to work with.

Hmm, if a Markdown file can have code interspersed, then can't a code file have Markdown interspersed, and the two interpretations of the file could in some sense be symmetric - and equally valid ?

Obv such "interspersions" exist in certain implementations, but I don't think such symmetries do, nor is there anything like a "standard" for it.

Literate programming using Markdown - who'da thunk it ?

Someone pls correct me if I'm OTL.


Yes, but support for showing the Markdown version is much more widespread.

observablehq puts Markdown in JavaScript code.

I think it works better with Markdown even if it wasn't supported in multiple places, but since it does, I think having Markdown be the container format is a clear winner.

There is also MDX but I prefer stuff that displays in the rendered view as well as in the source. Of course the renderers can change, but that's slow.

As for inverting them without losing the data, that seems possible and would be interesting to see.


Isn't that essentially what Jupyter does?


It's in JSON at least by default. Here's an example: https://github.com/tensorflow/examples/blob/master/courses/u...


Ah yes, it's stored as JSON, but look at all those "cell_type": "markdown", interspersed with the code cells. From the standpoint of a user, a Jupyter notebook is code and markdown interspersed.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: