GFM: Use ! to denote rendered/evaluated code blocks
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
Problem to solve
Gitlab-flavored markdown supports 2 kinds of code blocks:
- Code blocks that display verbatim with syntax highlighting
- Code blocks that stand for special displayable entities that should be evaluated and displayed
Type 1 code blocks are just like any other form of code, but type 2 are completely different. These are your mermaid diagrams and your katex blocks, and hopefully (if !44851 (merged) gets merged) dot blocks too.
The problem with this setup is that, for languages that both have syntax highlighting and evaluation support, it's ambiguous which one the user would like. This can be bad for the expanding number of type-2 code blocks that still have type-1 counterparts (like plantuml, dot, latex, etc).
User experience goal
Ideally, we'd want a UX that allows users to decide which kind of block they want as they're writing it. It might make sense to have a toggle button as well for these kinds of blocks to see the source, as we have for raw markdown, but special syntax for this should still be adopted.
Because of the types of users, we can't accept a solely UI/UX-based solution, since quite a few of them will want to only be concerned with the text itself and it would ruin the
Proposal
Over in the commonmark forum, users have suggested using ! to denote rendered / evaluated content:
```math
%% This will be syntax highlighted
\def\f#1#2{#1f(#2)}
\f\relax{x} = \int_{-\infty}^\infty
\f\hat\xi,e^{2 \pi i \xi x}
\,d\xi
```
```!math
%% This will be rendered
\def\f#1#2{#1f(#2)}
\f\relax{x} = \int_{-\infty}^\infty
\f\hat\xi,e^{2 \pi i \xi x}
\,d\xi
```
Further details
This does actually affect some of GitLab's other literate-programming-adjacent features, such as RunBooks.