oliverthiele / ot-markdown
Content Element and ViewHelper for Markdown with optional syntax highlighting.
Package info
github.com/oliverthiele/ot-markdown
Type:typo3-cms-extension
pkg:composer/oliverthiele/ot-markdown
Requires
- php: ^8.2
- league/commonmark: ^2.7.1
- typo3/cms-core: ^13.4
Requires (Dev)
- phpstan/phpstan: ^1.11
- phpunit/phpunit: ^10.5
- roave/security-advisories: dev-latest
README
Adds a Markdown content element and a Fluid ViewHelper to TYPO3 v13+. Supports inline Markdown and .md files from Fileadmin, rendered via league/commonmark with optional Prism.js syntax highlighting.
Features
- TYPO3 v13+ compatible (Site Set ready)
- Inline or file-based Markdown rendering (
.md,.markdown,.txt) - Optional syntax highlighting via Prism.js (CDN toggle)
- Frontmatter metadata support (
title,author, …) - Accessible output using semantic
<section>and<figure>elements - Reusable
MarkdownViewHelperfor custom Fluid templates - Configurable via Site Set settings and TypoScript
Requirements
| Requirement | Version |
|---|---|
| TYPO3 | ^13.4 |
| PHP | ^8.2 |
| league/commonmark | ^2.7 |
Installation
composer require oliverthiele/ot-markdown
After installation, activate the Site Set "OtMarkdown" for your site in the TYPO3 backend.
Configuration
Site Set Settings
| Key | Type | Default | Description |
|---|---|---|---|
OtMarkdown.useCdnForPrism |
bool | true |
Load Prism.js from CDN |
TypoScript
The TypoScript is auto-included via the Site Set. For manual integration without Site Set:
@import 'EXT:ot_markdown/Configuration/TypoScript/constants.typoscript'
@import 'EXT:ot_markdown/Configuration/TypoScript/setup.typoscript'
Default content element configuration:
tt_content.ot_markdown =< lib.contentElement
tt_content.ot_markdown {
templateName = Markdown
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
10.references.fieldName = assets
10.as = markdownFiles
}
}
Usage
Content Element
Select "Markdown" as content type (CType = ot_markdown) in the TYPO3 backend. Choose between:
- Inline — enter Markdown directly in the text field
- File — select a
.md,.markdown, or.txtfile from Fileadmin
ViewHelper
{namespace ot=OliverThiele\OtMarkdown\ViewHelpers}
<ot:markdown text="{data.bodytext}"/>
<ot:markdown file="{file}" as="output">
<f:format.raw>{output.html}</f:format.raw>
</ot:markdown>
Access frontmatter metadata via {output.frontmatter.title}, {output.frontmatter.author}, etc.
PHP API
use OliverThiele\OtMarkdown\Service\MarkdownService; use TYPO3\CMS\Core\Utility\GeneralUtility; $service = GeneralUtility::makeInstance(MarkdownService::class); $html = $service->render('# Hello World');
License
GPL-2.0-or-later — © 2025 Oliver Thiele