{"id":47968595,"url":"https://github.com/php-collective/symfony-djot","last_synced_at":"2026-06-19T04:02:11.866Z","repository":{"id":347254234,"uuid":"1193332029","full_name":"php-collective/symfony-djot","owner":"php-collective","description":"Djot markup language integration for Symfony — Twig filters, services, forms, validation and caching.  ","archived":false,"fork":false,"pushed_at":"2026-03-27T10:35:27.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-27T17:47:55.038Z","etag":null,"topics":["bundle","djot","markup","parser","symfony","twig"],"latest_commit_sha":null,"homepage":"https://php-collective.github.io/djot-php/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php-collective.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-27T05:31:42.000Z","updated_at":"2026-03-27T10:35:30.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/php-collective/symfony-djot","commit_stats":null,"previous_names":["php-collective/symfony-djot"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/php-collective/symfony-djot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-collective%2Fsymfony-djot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-collective%2Fsymfony-djot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-collective%2Fsymfony-djot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-collective%2Fsymfony-djot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-collective","download_url":"https://codeload.github.com/php-collective/symfony-djot/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-collective%2Fsymfony-djot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34516549,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bundle","djot","markup","parser","symfony","twig"],"created_at":"2026-04-04T10:40:48.058Z","updated_at":"2026-06-19T04:02:11.853Z","avatar_url":"https://github.com/php-collective.png","language":"PHP","funding_links":[],"categories":["Framework Integration"],"sub_categories":["Djot → HTML → Djot"],"readme":"# Symfony Djot Bundle\n\n[![CI](https://github.com/php-collective/symfony-djot/actions/workflows/ci.yml/badge.svg)](https://github.com/php-collective/symfony-djot/actions/workflows/ci.yml)\n[![PHP](https://img.shields.io/packagist/php-v/php-collective/symfony-djot)](https://packagist.org/packages/php-collective/symfony-djot)\n[![License](https://img.shields.io/packagist/l/php-collective/symfony-djot)](LICENSE)\n\n[Djot](https://github.com/php-collective/djot-php) markup language integration for Symfony — Twig filters, services, forms, and validation.\n\n## Installation\n\n```bash\ncomposer require php-collective/symfony-djot\n```\n\n## Usage\n\n### Twig Filter\n\n```twig\n{# Safe by default - XSS protection enabled #}\n{{ article.body|djot }}\n\n{# For trusted content only - no XSS protection #}\n{{ trustedContent|djot_raw }}\n\n{# Plain text output #}\n{{ article.body|djot_text }}\n```\n\n### Service\n\n```php\nuse PhpCollective\\SymfonyDjot\\Service\\DjotConverterInterface;\n\nclass ArticleController\n{\n    public function show(DjotConverterInterface $djot): Response\n    {\n        $html = $djot-\u003etoHtml($article-\u003ebody);\n        $text = $djot-\u003etoText($article-\u003ebody);\n    }\n}\n```\n\n## Configuration\n\n```yaml\n# config/packages/symfony_djot.yaml\nsymfony_djot:\n    converters:\n        # Default has safe_mode: true (XSS protection enabled)\n        default: ~\n\n        # For trusted content (admin, CMS)\n        trusted:\n            safe_mode: false\n    cache:\n        enabled: false\n        pool: cache.app\n```\n\n### Multiple Converter Profiles\n\nUse different configurations for different contexts:\n\n```twig\n{# Default is safe #}\n{{ comment.body|djot }}\n\n{# Use named converter for trusted content #}\n{{ article.body|djot('trusted') }}\n\n{# Or use djot_raw for quick trusted rendering #}\n{{ article.body|djot_raw }}\n```\n\n```php\npublic function __construct(\n    // Default converter (safe mode enabled)\n    private DjotConverterInterface $djot,\n\n    // Trusted converter (safe mode disabled)\n    #[Autowire(service: 'symfony_djot.converter.trusted')]\n    private DjotConverterInterface $trusted,\n) {}\n```\n\n### Safe Mode\n\nSafe mode is *enabled by default* for XSS protection. Disable only for trusted content:\n\n```yaml\nsymfony_djot:\n    converters:\n        trusted:\n            safe_mode: false\n```\n\n### Extensions\n\nEnable [djot-php extensions](https://github.com/php-collective/djot-php) per converter:\n\n```yaml\nsymfony_djot:\n    converters:\n        default:\n            extensions:\n                - type: autolink\n                - type: smart_quotes\n                - type: heading_permalinks\n                  symbol: '#'\n                  position: after\n        with_mentions:\n            extensions:\n                - type: mentions\n                  user_url_template: 'https://github.com/{username}'\n                - type: table_of_contents\n```\n\nAvailable extensions:\n- `admonition` - Admonition blocks (note, tip, warning, danger, etc.)\n- `autolink` - Auto-convert URLs to clickable links\n- `code_group` - Transform code-group divs into tabbed interfaces\n- `default_attributes` - Add default attributes to elements by type\n- `external_links` - Configure external link behavior (target, rel)\n- `frontmatter` - Parse YAML/TOML/JSON frontmatter blocks\n- `heading_level_shift` - Shift heading levels up/down\n- `heading_permalinks` - Add anchor links to headings\n- `heading_reference` - Link to headings with `[text](#heading)` syntax\n- `inline_footnotes` - Convert spans with class to inline footnotes\n- `mentions` - Convert @username to profile links\n- `mermaid` - Render Mermaid diagram code blocks\n- `semantic_span` - Convert spans to `\u003ckbd\u003e`, `\u003cdfn\u003e`, `\u003cabbr\u003e` elements\n- `smart_quotes` - Convert straight quotes to typographic quotes\n- `table_of_contents` - Generate TOC from headings\n- `tabs` - Tabbed content blocks (CSS or ARIA mode)\n- `wikilinks` - Support `[[Page Name]]` wiki-style links\n\nSee [Extensions documentation](https://php-collective.github.io/symfony-djot/extensions/) for detailed configuration options.\n\n### Form Type\n\nUse the `DjotType` for form fields that accept Djot markup:\n\n```php\nuse PhpCollective\\SymfonyDjot\\Form\\Type\\DjotType;\n\n$builder-\u003eadd('body', DjotType::class);\n```\n\n### Validation\n\nValidate that a field contains valid Djot markup:\n\n```php\nuse PhpCollective\\SymfonyDjot\\Validator\\Constraints\\ValidDjot;\n\nclass Article\n{\n    #[ValidDjot]\n    private string $body;\n}\n```\n\n## Documentation\n\nFull documentation: **[php-collective.github.io/symfony-djot](https://php-collective.github.io/symfony-djot/)**\n\n- [Installation](https://php-collective.github.io/symfony-djot/guide/installation)\n- [Configuration](https://php-collective.github.io/symfony-djot/guide/configuration)\n- [Twig Usage](https://php-collective.github.io/symfony-djot/guide/twig-usage)\n- [Service Usage](https://php-collective.github.io/symfony-djot/guide/service-usage)\n- [Forms](https://php-collective.github.io/symfony-djot/guide/forms)\n- [Validation](https://php-collective.github.io/symfony-djot/guide/validation)\n- [Safe Mode](https://php-collective.github.io/symfony-djot/guide/safe-mode)\n- [Extensions](https://php-collective.github.io/symfony-djot/extensions/)\n- [Caching](https://php-collective.github.io/symfony-djot/guide/caching)\n- [Djot Syntax](https://php-collective.github.io/symfony-djot/guide/djot-syntax)\n\n## Demo Application\n\nSee the [symfony-djot-demo](https://github.com/php-collective/symfony-djot-demo) for a complete example application.\n\n## What is Djot?\n\n[Djot](https://djot.net) is a modern light markup language created by John MacFarlane (author of CommonMark/Pandoc). It offers cleaner syntax and more features than Markdown while being easier to parse.\n\nLearn more about Djot syntax at [djot.net](https://djot.net).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-collective%2Fsymfony-djot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-collective%2Fsymfony-djot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-collective%2Fsymfony-djot/lists"}