{"id":13828352,"url":"https://github.com/twigphp/markdown-extension","last_synced_at":"2025-07-09T06:31:44.251Z","repository":{"id":57073951,"uuid":"172378635","full_name":"twigphp/markdown-extension","owner":"twigphp","description":"[DEPRECATED] Markdown support for Twig ","archived":true,"fork":false,"pushed_at":"2019-10-17T05:35:40.000Z","size":19,"stargazers_count":102,"open_issues_count":0,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-09T12:50:03.368Z","etag":null,"topics":["markdown","php","twig","twig-extension"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"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/twigphp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-24T19:11:02.000Z","updated_at":"2023-06-23T14:27:41.000Z","dependencies_parsed_at":"2022-08-24T10:50:20.104Z","dependency_job_id":null,"html_url":"https://github.com/twigphp/markdown-extension","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twigphp%2Fmarkdown-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twigphp%2Fmarkdown-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twigphp%2Fmarkdown-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/twigphp%2Fmarkdown-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/twigphp","download_url":"https://codeload.github.com/twigphp/markdown-extension/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225492420,"owners_count":17482869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["markdown","php","twig","twig-extension"],"created_at":"2024-08-04T09:02:42.697Z","updated_at":"2024-11-20T08:30:26.830Z","avatar_url":"https://github.com/twigphp.png","language":"PHP","readme":"Twig Markdown Extension\n=======================\n\n**WARNINIG**: This package is deprecate; migrate to `twig/markdown-extra` instead.\n\nThis package provides a Markdown to HTML filter (`markdown`) and an HTML to\nMarkdown filter (`html_to_markdown`) for Twig and a Symfony bundle.\n\nIf you are not using Symfony, register the extension on Twig's `Environment`\nmanually:\n\n```php\nuse Twig\\Markdown\\MarkdownExtension;\nuse Twig\\Environment;\n\n$twig = new Environment(...);\n$twig-\u003eaddExtension(new MarkdownExtension());\n```\n\nYou must also register the extension runtime (skip this step if you are using\nSymfony or a framework with a Twig integration):\n\n```php\nuse Twig\\Markdown\\DefaultMarkdown;\nuse Twig\\Markdown\\MarkdownRuntime;\nuse Twig\\RuntimeLoader\\RuntimeLoaderInterface;\n\n$twig-\u003eaddRuntimeLoader(new class implements RuntimeLoaderInterface {\n    public function load($class) {\n        if (MarkdownRuntime::class === $class) {\n            return new MarkdownRuntime(new DefaultMarkdown());\n        }\n    }\n});\n```\n\nUse the `markdown` and `html_to_markdown` filters from a Twig template:\n\n```twig\n{% filter markdown %}\nTitle\n======\n\nHello!\n{% endfilter %}\n\n{% filter html_to_markdown %}\n    \u003chtml\u003e\n        \u003ch1\u003eHello!\u003c/h1\u003e\n    \u003c/html\u003e\n{% endfilter %}\n```\n\nNote that you can indent the Markdown content as leading whitespaces will be\nremoved consistently before conversion:\n\n```twig\n{% filter markdown %}\n    Title\n    ======\n\n    Hello!\n{% endfilter %}\n```\n\nYou can also add some options by passing them as an argument to the filter:\n\n```twig\n{% filter html_to_markdown({hard_break: false}) %}\n    \u003chtml\u003e\n        \u003ch1\u003eHello!\u003c/h1\u003e\n    \u003c/html\u003e\n{% endfilter %}\n```\n\nYou can also use the filters on an included file:\n\n```twig\n{{ include('some_template.html.twig')|html_to_markdown }}\n\n{{ include('some_template.markdown.twig')|markdown }}\n```\n","funding_links":[],"categories":["PHP"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwigphp%2Fmarkdown-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftwigphp%2Fmarkdown-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftwigphp%2Fmarkdown-extension/lists"}