[feature request] Distinguish fenced code vs (code result or code's visual representation)


  • I added this feature to my markdown parsing but would like this feature to be part of the standard itself
  • I also noticed many variations of this, especially for mathematical formulas

Traditional fenced code

markdown :


html representation :


Evaluated fenced code

Sometimes we want to evaluate the code given without another tool, but more generally make it possible for more advanced parsers to be. Here is a proposal :



html representation:


The same applies for Graphs & Mathematical formulas

This should proposal should also take into consideration code that renders : a graph or a mathematical formula e.g. :

markdown :


I don’t think it makes sense to add it in the spec. It would make it quite difficult to implement parsers. If I want to write a PHP parser, I would then have to implement (or depend on) a Ruby runner in PHP to support eval[ruby] (and so on for any other language). Thus the usefulness of this is quite limited. A code block is generally much more useful than the output of the evaluation (which implies that the code block is a complete program to have anything useful btw).
In case of programming language, the syntax highlighting is generally much more useful than the evaluation IMO.

For the case of graphviz, it might indeed be a good idea to render it rather than displaying the source in some cases, but I don’t think this belongs to the spec either (it is more about postprocessing the file)

It seems like this can be handled through the existing mechanism - just tag it with an appropriate class indicating it should be evaluated or rendered or whatever, then whatever JS library you use (or similar) can look for that class and do the evaluation itself.

1 Like

I am just asking for the standard to provide us with the correct “class indication”.
And not let us with the variations that currently exists for having :

  • code evaluation
  • graph rendering
  • math formulas rendering