Add syntax highlighting and Mermaid rendering for org-mode files
Problem
org-mode files in repositories rendered without syntax highlighting or Mermaid diagram support. GitHub has rendered org-mode source blocks with syntax highlighting since around 2010, but this was not supported in GitLab (#32207 (closed)).
What does this MR do?
- Updated
CodeLanguageFilterto handle bare<pre lang="python">code</pre>output produced by org-ruby (without a<code>wrapper). This enables syntax highlighting for#+begin_srcblocks in org-mode files. - Added
MermaidFiltertoMarkupPipeline. This enables Mermaid diagram rendering for#+begin_src mermaidin org-mode files. - As a side effect, reStructuredText and Textile files also renders Mermaid diagrams (reST and Textile source blocks already had syntax highlighting).
- As a further side effect, code blocks in
.rdocand.creolefiles gain Mermaid rendering (if the underlying markup parser produces a<pre><code>shape, or<pre lang>that the new wrapping logic normalizes). Based on current testing,.wikiand.mediawikicontent does not produce Mermaid‑renderable code blocks with this pipeline.
Screenshots
Manually verified rendering in GDK-in-a-box.
org-mode — syntax highlighting + Mermaid
| Before (gitlab.com) | After (GDK-in-a-box) |
|---|---|
![]() |
![]() |
![]() |
![]() |
Source:
#+BEGIN_SRC python
def function():
s = "Python code"
print s
#+END_SRC
#+BEGIN_SRC mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
#+END_SRCreStructuredText — Mermaid
| Before (gitlab.com) | After (GDK-in-a-box) |
|---|---|
![]() |
![]() |
Source:
.. code:: mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;Textile — Mermaid
| Before (gitlab.com) | After (GDK-in-a-box) |
|---|---|
![]() |
![]() |
Source:
bc[mermaid]. graph TD;
A-->B;
A-->C;
B-->D;
C-->D;Notes
- No docs updates included — this area isn't well covered by existing documentation. If there are specific docs that should be updated, please flag them.
- First contribution to GitLab — any guidance on process or conventions would be appreciated.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by skkzsh







