GitHub Flavored Markdown Enhancements β¨
Weβve enhanced our lightweight Parsedown-style PHP parser to support key GitHub Flavored Markdown (GFM) features, while keeping the code simple, fast, and dependency-free.
These changes improve compatibility with GitHub, GitLab, and modern markdown editors β without turning the parser into a full CommonMark implementation.
Whatβs New?
The parser now supports several popular GFM extensions commonly used in real-world markdown files.
β Fenced Code Blocks with Language Support
You can now specify a language after the opening fence:
echo "Hello world";
This renders as:
<pre><code class="language-php">...</code></pre>
Perfect for syntax highlighting with Prism.js or Highlight.js.
β Strikethrough Text
GitHub-style strikethrough is now supported:
~~This text is crossed out~~
Rendered as:
<del>This text is crossed out</del>
β Task Lists (Checkboxes)
Task lists are fully supported inside unordered lists:
- [x] Completed task
- [ ] Pending task
Rendered as disabled checkboxes, matching GitHub behavior:
- β Completed task
- β Pending task
This is especially useful for documentation, roadmaps, and issue-style content.
β Automatic Links (Autolinks)
Raw URLs are now automatically converted into clickable links:
Visit https://example.com for more info
No need to wrap URLs in markdown link syntax.
β Safer Inline Code Handling
Inline code now properly escapes HTML and ignores markdown formatting inside backticks:
Use `*this_variable*` in your code
This prevents formatting bugs and improves security.
β Basic GitHub-Style Tables
Simple tables are now supported:
| Feature | Supported |
|--------|-----------|
| Code blocks | Yes |
| Task lists | Yes |
| Tables | Yes |
Rendered as a semantic HTML table:
<table>
<thead>...</thead>
<tbody>...</tbody>
</table>
Note: This is a lightweight table implementation, not a full CommonMark spec.
What Didnβt Change?
To keep the parser fast and readable:
- No external dependencies were added
- No full AST or CommonMark parser
- Existing markdown remains backward-compatible
- Performance characteristics remain the same
Ideal Use Cases
These enhancements are perfect for:
- File-based blogs
- Documentation systems
- HumHub modules
- Lightweight CMS tools
- GitHub-style README rendering
Whatβs Next?
Possible future enhancements include:
- Emoji support (
:rocket:β π) - GitHub mentions (
@user,#123) - HTML sanitization for untrusted input
- Footnotes
- Extensions tailored for HumHub content
Happy writing with GitHub-style Markdown! π