https://bugs.kde.org/show_bug.cgi?id=515330
Bug ID: 515330
Summary: Markdown code blocks are not syntax highlighted in
rendered preview
Classification: Frameworks and Libraries
Product: markdownpart
Version First unspecified
Reported In:
Platform: Arch Linux
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: general
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
SUMMARY
Markdown code blocks are not syntax highlighted in rendered preview
STEPS TO REPRODUCE
1. Open any Markdown file containing fenced code blocks with language
specifiers (e.g., ```bash, ```python, ```javascript)
2. View the rendered Markdown preview using markdownpart (in Kate, Ghostwriter,
KleverNotes, ReText, or any KParts-based application)
3. Observe the code blocks in the preview
OBSERVED RESULT
Code blocks appear in monospace font but without any syntax highlighting. All
code text is displayed in the same color regardless of the specified language.
EXPECTED RESULT
Code blocks should be syntax highlighted according to the language specified in
the fence (```bash, ```python, etc.), using KSyntaxHighlighting framework or
similar to apply appropriate colors to keywords, strings, comments, and other
language elements.
SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux (kernel 6.12.10)
KDE Plasma Version: 6.5.5
KDE Frameworks Version: 6.11.0
Qt Version: 6.8.1
markdownpart Version: 25.12.1-1
ADDITIONAL INFORMATION
Investigation shows that markdownpart uses libmd4c for Markdown parsing but
does not link against KSyntaxHighlighting or any other syntax highlighting
library (verified with ldd). The generated HTML contains plain <code> tags
without highlighting classes or inline styles.
KDE already has the necessary infrastructure for syntax highlighting
(KSyntaxHighlighting framework with definitions in
/usr/share/org.kde.syntax-highlighting/syntax-bundled/), which is used
successfully in Kate's editor view. Integrating this into markdownpart would
provide consistent, high-quality syntax highlighting for code blocks in
Markdown previews across all KParts-based applications.
This affects user experience when viewing technical documentation, code
snippets, or any Markdown content with code examples in Kate, Ghostwriter,
KleverNotes, ReText, and other KDE applications that use markdownpart.
Related resources:
- KSyntaxHighlighting framework:
https://api.kde.org/frameworks/syntax-highlighting/html/
- CommonMark spec on fenced code blocks:
https://spec.commonmark.org/0.31.2/#fenced-code-blocks
--
You are receiving this mail because:
You are watching all bug changes.