{"id":34001212,"url":"https://github.com/parsemd/parsemd-php","last_synced_at":"2026-04-06T09:01:32.372Z","repository":{"id":57035994,"uuid":"89792087","full_name":"Parsemd/Parsemd-PHP","owner":"Parsemd","description":"A modular parser for CommonMark, GitHub-Flavoured-Markdown, and beyond...","archived":false,"fork":false,"pushed_at":"2017-09-16T12:23:29.000Z","size":274,"stargazers_count":4,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-14T21:59:23.443Z","etag":null,"topics":["commonmark","github-flavored-markdown","modular","parser"],"latest_commit_sha":null,"homepage":"","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/Parsemd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-29T14:51:51.000Z","updated_at":"2024-11-21T15:33:40.000Z","dependencies_parsed_at":"2022-08-24T06:40:21.734Z","dependency_job_id":null,"html_url":"https://github.com/Parsemd/Parsemd-PHP","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Parsemd/Parsemd-PHP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Parsemd%2FParsemd-PHP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Parsemd%2FParsemd-PHP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Parsemd%2FParsemd-PHP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Parsemd%2FParsemd-PHP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Parsemd","download_url":"https://codeload.github.com/Parsemd/Parsemd-PHP/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Parsemd%2FParsemd-PHP/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31466228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T08:36:52.050Z","status":"ssl_error","status_checked_at":"2026-04-06T08:36:51.267Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["commonmark","github-flavored-markdown","modular","parser"],"created_at":"2025-12-13T09:45:07.307Z","updated_at":"2026-04-06T09:01:32.359Z","avatar_url":"https://github.com/Parsemd.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Parsemd [![Build Status](https://travis-ci.org/Parsemd/Parsemd.svg?branch=master)](https://travis-ci.org/Parsemd/Parsemd) [![Build Status](https://ci.appveyor.com/api/projects/status/github/parsemd/parsemd?branch=master\u0026svg=true\u0026retina=true)](https://ci.appveyor.com/project/aidantwoods/parsemd)\nA modular parser for CommonMark, GitHub-Flavoured-Markdown, and beyond. Lovingly crafted in PHP 7.1.\n\n## Aims\nOne of the main objectives for this parser is creating a system where CommonMark, GitHub-Flavoured-Markdown, and [insert your own dialects here] can co-exist and specific inline/block elements from each can be used in a modular fashion.\n\n*(there will be a YAML file config for authors to use to piece this selection together eventually).*\n\nAnother objective is usability, and with that comes a variety of things, including but not limited to:\n* Accuracy of the built in dialects(/flavours) to their specifications\n* A variety of output formats, creating abstract implementations of common structures (so that slight modifications e.g. particular marker used, how many are used is trivial to adjust)\n* Creating a general purpose parsing strategy such that implementations of specific inlines/blocks do not have to be aware of each other, or of how they should cope with various types of intersections. (e.g. inline elements that can be extended to avoid intersection will be without the inline implementation having to be aware that this is possible).\n\n\n## Aims (tl;dr)\n* Be CommonMark compliant by default\n* Make adding custom structures (blocks/inlines)/rules easy and modular\n* Decouple HTML output from understanding of the markdown structure (aiming for output in HTML, LaTeX, and beyond)\n\n## Caveats\n* Under initial development: (issues welcome), PRs encouraged\n* I might move things around drastically (see under initial development)\n\n## FAQ\n- Q: Why u no \u003c PHP 7.1 ?! ![y-u-no-guy](https://cloud.githubusercontent.com/assets/3288888/25992650/26c732d4-36ff-11e7-8f0d-a701c9858a94.jpg)\n- A: Just as PHP 7 is a much better language than 5.x, 7.1 comes with a few of its [own improvements](http://php.net/manual/en/migration71.new-features.php). In particular, nullable return types are made use of extensively in this project. This is achievable in versions prior, but only by forgoing type safety, or by introducing boilerplate code to check functions return what you expect them to. This task is much better achieved by use of an interface, and affords the same advantages to any modular additions.\n\n## Examples\nEmphasis and strong emphasis are by far the most complex inline structures.\nOne of the aims of this parser is to have lots of reusable code.\n\nHere we have an abstraction of emphasis (like a CommonMark emphasis, except\nnumber of delimiters in a delimiter run is arbitrary – like inline code).\n\nThis is everything we need to define a new type of emphasis, strikethrough.\n```php\n\u003c?php\ndeclare(strict_types=1);\n\nnamespace Parsemd\\Parsemd\\Parsers\\Aidantwoods\\Inlines;\n\nuse Parsemd\\Parsemd\\Parsers\\Inline;\nuse Parsemd\\Parsemd\\Parsers\\Parsemd\\Abstractions\\Inlines\\Emphasis;\n\nclass StrikeThrough extends Emphasis implements Inline\n{\n    protected const TAG = 'del';\n    protected const MARKERS = [\n        '~'\n    ];\n}\n```\n\nInfact, the CommonMark emphasis implementation too extends this abstract\nidea. Though some adjustments have to be made to separate the `*` delimiter from\nthe `**` delimiter, and so-forth for `_`.\n\nThat implementation is only slightly longer though. Here it is.\n```php\n\u003c?php\ndeclare(strict_types=1);\n\nnamespace Parsemd\\Parsemd\\Parsers\\CommonMark\\Inlines;\n\nuse Parsemd\\Parsemd\\Parsers\\Inline;\nuse Parsemd\\Parsemd\\Parsers\\Parsemd\\Abstractions\\Inlines\\Emphasis;\n\nclass ShortEmph extends Emphasis implements Inline\n{\n    protected const TAG = 'em';\n\n    protected const MARKERS = [\n        '*', '_'\n    ];\n\n    protected const INTRAWORD_MARKER_BLACKLIST = [\n        '_'\n    ];\n\n    protected const MAX_RUN = 1;\n    protected const MIN_RUN = 1;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparsemd%2Fparsemd-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparsemd%2Fparsemd-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparsemd%2Fparsemd-php/lists"}