{"id":33018423,"url":"https://github.com/kzykhys/Ciconia","last_synced_at":"2025-11-16T14:00:37.533Z","repository":{"id":9840371,"uuid":"11831185","full_name":"kzykhys/Ciconia","owner":"kzykhys","description":"A New Markdown parser for PHP5.4","archived":false,"fork":false,"pushed_at":"2016-03-08T10:27:16.000Z","size":1185,"stargazers_count":351,"open_issues_count":19,"forks_count":28,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-10-28T16:52:09.463Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://ciconia.kzykhys.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"dropbox/lepton","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kzykhys.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}},"created_at":"2013-08-02T00:39:01.000Z","updated_at":"2025-09-13T06:33:52.000Z","dependencies_parsed_at":"2022-09-07T03:41:27.515Z","dependency_job_id":null,"html_url":"https://github.com/kzykhys/Ciconia","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/kzykhys/Ciconia","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kzykhys%2FCiconia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kzykhys%2FCiconia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kzykhys%2FCiconia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kzykhys%2FCiconia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kzykhys","download_url":"https://codeload.github.com/kzykhys/Ciconia/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kzykhys%2FCiconia/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284719042,"owners_count":27052182,"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","status":"online","status_checked_at":"2025-11-16T02:00:05.974Z","response_time":65,"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":[],"created_at":"2025-11-13T18:00:39.568Z","updated_at":"2025-11-16T14:00:37.527Z","avatar_url":"https://github.com/kzykhys.png","language":"PHP","funding_links":[],"categories":["标记","Markup","标记( Markup )","标记 Markup"],"sub_categories":[],"readme":"Ciconia - A New Markdown Parser for PHP\n=======================================\n\n[![Latest Stable Version](https://poser.pugx.org/kzykhys/ciconia/v/stable.png)](https://packagist.org/packages/kzykhys/ciconia)\n[![Build Status](https://travis-ci.org/kzykhys/Ciconia.png?branch=master)](https://travis-ci.org/kzykhys/Ciconia)\n[![Coverage Status](https://coveralls.io/repos/kzykhys/Ciconia/badge.png?branch=master)](https://coveralls.io/r/kzykhys/Ciconia?branch=master)\n[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d0ca7ab7-c342-4f04-8f67-b7d74c2fdb66/mini.png)](https://insight.sensiolabs.com/projects/d0ca7ab7-c342-4f04-8f67-b7d74c2fdb66)\n\nThe Markdown parser for PHP5.4, it is fully extensible.\nCiconia is the collection of extension, so you can replace, add or remove each parsing mechanism.\n\n[**Try Demo**][ciconia-demo] / [**Docs**][ciconia-docs] / [**Supported Syntax**][ciconia-syntax] / [**API Reference**][ciconia-api]\n\n*   Based on John Gruber's Markdown.pl\n\n*   [Github Flavored Markdown](https://help.github.com/articles/github-flavored-markdown) support (disabled by default)\n\n    * Multiple underscores in words\n    * New lines\n    * Fenced code blocks\n    * Task lists\n    * Table\n    * URL Autolinking\n\n*   Tested with [karlcow/markdown-testsuite](https://github.com/karlcow/markdown-testsuite)\n\nRequirements\n------------\n\n* PHP5.4+\n* Composer\n\nInstallation\n------------\n\ncreate a `composer.json`\n\n``` json\n{\n    \"require\": {\n        \"kzykhys/ciconia\": \"~1.0.0\"\n    }\n}\n```\n\nand run\n\n```\nphp composer.phar install\n```\n\nUsage\n-----\n\n### Traditional Markdown\n\n``` php\nuse Ciconia\\Ciconia;\n\n$ciconia = new Ciconia();\n$html = $ciconia-\u003erender('Markdown is **awesome**');\n\n// \u003cp\u003eMarkdown is \u003cem\u003eawesome\u003c/em\u003e\u003c/p\u003e\n```\n\n### Github Flavored Markdown\n\nTo activate 6 gfm features:\n\n``` php\nuse Ciconia\\Ciconia;\nuse Ciconia\\Extension\\Gfm;\n\n$ciconia = new Ciconia();\n$ciconia-\u003eaddExtension(new Gfm\\FencedCodeBlockExtension());\n$ciconia-\u003eaddExtension(new Gfm\\TaskListExtension());\n$ciconia-\u003eaddExtension(new Gfm\\InlineStyleExtension());\n$ciconia-\u003eaddExtension(new Gfm\\WhiteSpaceExtension());\n$ciconia-\u003eaddExtension(new Gfm\\TableExtension());\n$ciconia-\u003eaddExtension(new Gfm\\UrlAutoLinkExtension());\n\n$html = $ciconia-\u003erender('Markdown is **awesome**');\n\n// \u003cp\u003eMarkdown is \u003cem\u003eawesome\u003c/em\u003e\u003c/p\u003e\n```\n\n### Options\n\nOption             | Type    | Default | Description                   |\n-------------------|---------|---------|-------------------------------|\n**tabWidth**       | integer | 4       | Number of spaces              |\n**nestedTagLevel** | integer | 3       | Max depth of nested HTML tags |\n**strict**         | boolean | false   | Throws exception if markdown contains syntax error |\n\n``` php\nuse Ciconia\\Ciconia;\n\n$ciconia = new Ciconia();\n$html = $ciconia-\u003erender(\n    'Markdown is **awesome**',\n    ['tabWidth' =\u003e 8, 'nestedTagLevel' =\u003e 5, 'strict' =\u003e true]\n);\n```\n\nRendering HTML or XHTML\n-----------------------\n\nCiconia renders HTML by default. If you prefer XHTML:\n\n``` php\nuse Ciconia\\Ciconia;\nuse Ciconia\\Renderer\\XhtmlRenderer;\n\n$ciconia = new Ciconia(new XhtmlRenderer());\n$html = $ciconia-\u003erender('Markdown is **awesome**');\n\n// \u003cp\u003eMarkdown is \u003cem\u003eawesome\u003c/em\u003e\u003c/p\u003e\n```\n\nExtend Ciconia\n--------------\n\n### How to Extend\n\nCreating extension is easy, just implement `Ciconia\\Extension\\ExtensionInterface`.\n\nYour class must implement 2 methods.\n\n#### _void_ register(`Ciconia\\Markdown` $markdown)\n\nRegister your callback to markdown event manager.\n`Ciconia\\Markdown` is instance of `Ciconia\\Event\\EmitterInterface` (looks like Node.js's EventEmitter)\n\n#### _string_ getName()\n\nReturns the name of your extension.\nIf your name is the same as one of core extension, it will be replaced by your extension.\n\n### Extension Example\n\nThis sample extension turns `@username ` mentions into links.\n\n``` php\n\u003c?php\n\nuse Ciconia\\Common\\Text;\nuse Ciconia\\Extension\\ExtensionInterface;\n\nclass MentionExtension implements ExtensionInterface\n{\n\n    /**\n     * {@inheritdoc}\n     */\n    public function register(\\Ciconia\\Markdown $markdown)\n    {\n        $markdown-\u003eon('inline', [$this, 'processMentions']);\n    }\n\n    /**\n     * @param Text $text\n     */\n    public function processMentions(Text $text)\n    {\n        // Turn @username into [@username](http://example.com/user/username)\n        $text-\u003ereplace('/(?:^|[^a-zA-Z0-9.])@([A-Za-z]+[A-Za-z0-9]+)/', function (Text $w, Text $username) {\n            return '[@' . $username . '](http://example.com/user/' . $username . ')';\n        });\n    }\n\n    /**\n     * {@inheritdoc}\n     */\n    public function getName()\n    {\n        return 'mention';\n    }\n}\n```\n\nRegister your extension.\n\n``` php\n\u003c?php\n\nrequire __DIR__ . '/vendor/autoload.php';\n\n$ciconia = new \\Ciconia\\Ciconia();\n$ciconia-\u003eaddExtension(new MentionExtension());\necho $ciconia-\u003erender('@kzykhys my email address is example@example.com!');\n```\n\nOutput\n\n``` html\n\u003cp\u003e\u003ca href=\"http://example.com/user/kzykhys\"\u003e@kzykhys\u003c/a\u003e my email address is example@example.com!\u003c/p\u003e\n```\n\nEach extension handles string as a `Text` object. See [API section of kzykhys/Text][textapi].\n\n### Events\n\nPossible events are:\n\n| Event      | Description                                                                               |\n|------------|-------------------------------------------------------------------------------------------|\n| initialize | Document level parsing. Called at the first of the sequence.                              |\n| block      | Block level parsing. Called after `initialize`                                            |\n| inline     | Inline level parsing. Generally called by block level parsers.                            |\n| detab      | Convert tabs to spaces. Generally called by block level parsers.                          |\n| outdent    | Remove one level of line-leading tabs or spaces. Generally called by block level parsers. |\n| finalize   | Called after `block`                                                                      |\n\n[See the source code of Extensions](src/Ciconia/Extension)\n\n[See events and timing information](https://gist.github.com/kzykhys/7443440)\n\n### Create your own Renderer\n\nCiconia supports HTML/XHTML output. but if you prefer customizing the output,\njust create a class that implements `Ciconia\\Renderer\\RendererInterface`.\n\nSee [Ciconia\\Renderer\\RendererInterface](src/Ciconia/Renderer/RendererInterface.php)\n\nCommand Line Interface\n----------------------\n\n### Usage\n\nBasic Usage: (Outputs result to STDOUT)\n\n    ciconia /path/to/file.md\n\nFollowing command saves result to file:\n\n    ciconia /path/to/file.md \u003e /path/to/file.html\n\nOr using pipe (On Windows in does't work):\n\n    echo \"Markdown is **awesome**\" | ciconia\n\n### Command Line Options\n\n```\n --gfm                 Activate Gfm extensions\n --compress (-c)       Remove whitespace between HTML tags\n --format (-f)         Output format (html|xhtml) (default: \"html\")\n --lint (-l)           Syntax check only (lint)\n```\n\n### Where is the script?\n\nCLI script will be installed in `vendor/bin/ciconia` by default.\nTo change the location:\n\n\u003e Yes, there are two ways an alternate vendor binary location can be specified:\n\u003e\n\u003e 1. Setting the bin-dir configuration setting in composer.json\n\u003e 2. Setting the environment variable COMPOSER_BIN_DIR\n\n[http://getcomposer.org/doc/articles/vendor-binaries.md](http://getcomposer.org/doc/articles/vendor-binaries.md)\n\n### Using PHAR version\n\nYou can also use [single phar file][phar]\n\n```\nciconia.phar /path/to/file.md\n```\n\nIf you prefer access this command globally, download [ciconia.phar][phar] and move it into your `PATH`.\n\n```\nmv ciconia.phar /usr/local/bin/ciconia\n```\n\nTesting\n-------\n\nInstall or update `dev` dependencies.\n\n```\nphp composer.phar update --dev\n```\n\nand run `phpunit`\n\nLicense\n-------\n\nThe MIT License\n\nContributing\n------------\n\nFeel free to fork this repository and send a pull request. ([A list of contributors][contributors])\n\nAuthor\n------\n\nKazuyuki Hayashi (@kzykhys)\n\n\n[milestones]: https://github.com/kzykhys/Ciconia/issues/milestones\n[phar]: https://github.com/kzykhys/Ciconia/releases/download/v1.0.3/ciconia.phar\n[contributors]: https://github.com/kzykhys/Ciconia/graphs/contributors\n[textapi]: https://github.com/kzykhys/Text#api\n\n[ciconia-demo]: http://ciconia.kzykhys.com/\n[ciconia-docs]: http://ciconia.kzykhys.com/docs/\n[ciconia-syntax]: http://ciconia.kzykhys.com/syntax.html\n[ciconia-api]: http://ciconia.kzykhys.com/api/","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkzykhys%2FCiconia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkzykhys%2FCiconia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkzykhys%2FCiconia/lists"}