{"id":13483577,"url":"https://github.com/icyleaf/markd","last_synced_at":"2025-04-04T22:08:49.174Z","repository":{"id":21557365,"uuid":"93261243","full_name":"icyleaf/markd","owner":"icyleaf","description":"Yet another markdown parser, Compliant to CommonMark specification, written in Crystal.","archived":false,"fork":false,"pushed_at":"2025-03-25T14:20:04.000Z","size":651,"stargazers_count":111,"open_issues_count":11,"forks_count":33,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-28T21:09:12.251Z","etag":null,"topics":["commonmark","crystal","gfm","markdown","markdown-flavors"],"latest_commit_sha":null,"homepage":"","language":"Crystal","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/icyleaf.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-03T16:44:53.000Z","updated_at":"2025-03-25T14:20:08.000Z","dependencies_parsed_at":"2024-05-23T09:30:46.602Z","dependency_job_id":"7baaa7ab-694a-4d6e-8137-add3b9f56318","html_url":"https://github.com/icyleaf/markd","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icyleaf%2Fmarkd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icyleaf%2Fmarkd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icyleaf%2Fmarkd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icyleaf%2Fmarkd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icyleaf","download_url":"https://codeload.github.com/icyleaf/markd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247256115,"owners_count":20909240,"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":["commonmark","crystal","gfm","markdown","markdown-flavors"],"created_at":"2024-07-31T17:01:12.968Z","updated_at":"2025-04-04T22:08:49.147Z","avatar_url":"https://github.com/icyleaf.png","language":"Crystal","funding_links":[],"categories":["Markdown/Text Processors"],"sub_categories":[],"readme":"# markd\n\n[![Language](https://img.shields.io/badge/language-crystal-776791.svg)](https://github.com/crystal-lang/crystal)\n[![Tag](https://img.shields.io/github/tag/icyleaf/markd.svg)](https://github.com/icyleaf/markd/blob/master/CHANGELOG.md)\n[![Build Status](https://img.shields.io/circleci/project/github/icyleaf/markd/master.svg?style=flat)](https://circleci.com/gh/icyleaf/markd)\n\n\n**THIS PROJECT IS LOOKING FOR MAINTAINER**\n\nUnfortunately, the maintainer no longer has the time and/or resources to work on markd further. This means that bugs will not be fixed and features will not be added unless someone else does so. \n\nIf you're interested in fixing up markd, please [file an issue](https://github.com/icyleaf/markd/issues/new) let me know.\n\n\u003chr /\u003e\n\nYet another markdown parser built for speed, written in [Crystal](https://crystal-lang.org), Compliant to [CommonMark](http://spec.commonmark.org) specification (`v0.29`). Copy from [commonmark.js](https://github.com/jgm/commonmark.js).\n\n## Installation\n\nAdd this to your application's `shard.yml`:\n\n```yaml\ndependencies:\n  markd:\n    github: icyleaf/markd\n```\n\n## Quick start\n\n```crystal\nrequire \"markd\"\n\nmarkdown = \u003c\u003c-MD\n# Hello Markd\n\n\u003e Yet another markdown parser built for speed, written in Crystal, Compliant to CommonMark specification.\nMD\n\nhtml = Markd.to_html(markdown)\n```\n\nAlso here are options to configure the parse and render.\n\n```crystal\noptions = Markd::Options.new(smart: true, safe: true)\nMarkd.to_html(markdown, options)\n```\n\n## Options\n\n| Name        | Type   | Default value | Description                                                                                                                                                                     |\n| ----------- | ------ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| time        | `Bool` | false         | render parse cost time during read source, parse blocks, parse inline.                                                                                                          |\n| smart       | `Bool` | false         | if **true**, straight quotes will be made curly,\u003cbr /\u003e`--` will be changed to an en dash,\u003cbr /\u003e`---` will be changed to an em dash, and\u003cbr /\u003e`...` will be changed to ellipses. |\n| source_pos  | `Bool` | false         | if **true**, source position information for block-level elements\u003cbr /\u003ewill be rendered in the data-sourcepos attribute (for HTML)                                              |\n| safe        | `Bool` | false         | if **true**, raw HTML will not be passed through to HTML output (it will be replaced by comments)                                                                               |\n| prettyprint | `Bool` | false         | if **true**, code tags generated by code blocks will have a `prettyprint` class added to them, to be used by [Google code-prettify](https://github.com/google/code-prettify).   |\n| gfm         | `Bool` | false         | **Not supported for now**                                                                                                                                                         |\n| toc         | `Bool` | false         | **Not supported for now**                                                                                                                                                         |\n| base_url    | `URI?` | nil           | if not **nil**, relative URLs of links are resolved against this `URI`. It act's like HTML's `\u003cbase href=\"base_url\"\u003e` in the context of a Markdown document.                    |\n\n## Advanced\n\nIf you want to use a custom renderer, it can!\n\n```crystal\n\nclass CustomRenderer \u003c Markd::Renderer\n\n  def strong(node, entering)\n  end\n\n  # more methods following in render.\nend\n\noptions = Markd::Options.new(time: true)\ndocument = Markd::Parser.parse(markdown, options)\nrenderer = CustomRenderer.new(options)\n\nhtml = renderer.render(document)\n```\n\n## Use tartrazine shards to render code block.\n\nAdded and require [tartrazine](https://github.com/ralsina/tartrazine) before markd will use it to render code block.\n\nBy default, it use formatter like following:\n\n```crystal\nformatter = Tartrazine::Html.new(\n  theme: Tartrazine.theme(\"catppuccin-macchiato\"),\n  line_numbers: true,\n  standalone: true,\n)\n```\n\nYou can passing a formatter instead.\n\ne.g.\n\n```crystal\nrequire \"tartrazine\" # require it before markd\nrequire \"markd\"\n\nformatter = Tartrazine::Html.new(\n  theme: Tartrazine.theme(\"emacs\"),\n  \n  # Disable print line number\n  line_numbers: false,\n  \n  # Set standalone to false for better performace.\n  #\n  # You need generate css file use `bin/tartrazine -f html -t \"emacs\" --css`, \n  # then link it in you site.\n  standalone: false,\n)\n\nhtml = Markd.to_html(markdown,formatter: formatter)\n```\n\nIf you don't care about the formatter config, you can just passing a string instead.\n\n```crystal\nrequire \"tartrazine\" # require it before markd\nrequire \"markd\"\n\nhtml = Markd.to_html(markdown, formatter: \"emacs\")\n```\n\n\nCurrently Tartrazine supports 247 languages and [331 themes](https://github.com/ralsina/tartrazine/tree/main/styles), you can retrieve the supported languages use `Tartrazine::LEXERS_BY_NAME.values.uniq.sort`, for now the result is:\n\n```crystal\n[\n  \"LiquidLexer\", \"VelocityLexer\", \n  \n  \"abap\", \"abnf\", \"actionscript\", \"actionscript_3\", \"ada\", \"agda\", \"al\", \"alloy\", \"angular2\", \n  \"antlr\",   \"apacheconf\", \"apl\", \"applescript\", \"arangodb_aql\", \"arduino\", \"armasm\", \n  \"autohotkey\", \"autoit\", \"awk\", \n  \n  \"ballerina\", \"bash\", \"bash_session\", \"batchfile\", \"bbcode\", \"bibtex\", \"bicep\", \"blitzbasic\", \n  \"bnf\", \"bqn\", \"brainfuck\", \n  \n  \"c\", \"c#\", \"c++\", \"cap_n_proto\", \"cassandra_cql\", \"ceylon\", \"cfengine3\", \"cfstatement\", \n  \"chaiscript\", \"chapel\",   \"cheetah\", \"clojure\", \"cmake\", \"cobol\", \"coffeescript\", \n  \"common_lisp\", \"coq\", \"crystal\", \"css\", \"cue\", \"cython\", \n  \n  \"d\", \"dart\", \"dax\", \"desktop_entry\", \"diff\", \"django_jinja\", \"dns\", \"docker\", \"dtd\", \"dylan\", \n  \n  \"ebnf\", \"elixir\", \"elm\", \"emacslisp\", \"erlang\", \n  \n  \"factor\", \"fennel\", \"fish\", \"forth\", \"fortran\", \"fortranfixed\", \"fsharp\", \n  \n  \"gas\", \"gdscript\", \"gdscript3\", \"gherkin\", \"gleam\", \"glsl\", \"gnuplot\", \"go_template\", \n  \"graphql\", \"groff\", \"groovy\", \n  \n  \"handlebars\", \"hare\", \"haskell\", \"hcl\", \"hexdump\", \"hlb\", \"hlsl\", \"holyc\", \"html\", \"hy\", \n  \n  \"idris\", \"igor\", \"ini\", \"io\", \"iscdhcpd\", \n  \n  \"j\", \"java\", \"javascript\", \"json\", \"jsonata\", \"julia\", \"jungle\", \n  \n  \"kotlin\", \n  \n  \"lighttpd_configuration_file\", \"llvm\", \"lua\", \n  \n  \"makefile\", \"mako\", \"markdown\", \"mason\", \"materialize_sql_dialect\", \"mathematica\", \"matlab\", \n  \"mcfunction\", \"meson\", \"metal\", \"minizinc\", \"mlir\", \"modula-2\", \"moinwiki\", \"monkeyc\", \n  \"morrowindscript\", \"myghty\", \"mysql\", \n  \n  \"nasm\", \"natural\", \"ndisasm\", \"newspeak\", \"nginx_configuration_file\", \"nim\", \"nix\", \n  \n  \"objective-c\", \"objectpascal\", \"ocaml\", \"octave\", \"odin\", \"onesenterprise\", \"openedge_abl\", \n  \"openscad\", \"org_mode\", \n  \n  \"pacmanconf\", \"perl\", \"php\", \"pig\", \"pkgconfig\", \"pl_pgsql\", \"plaintext\", \"plutus_core\", \n  \"pony\", \"postgresql_sql_dialect\", \"postscript\", \"povray\", \"powerquery\", \"powershell\", \n  \"prolog\", \"promela\", \"promql\", \"properties\", \"protocol_buffer\",   \"prql\", \"psl\", \"puppet\", \n  \"python\", \"python_2\", \n  \n  \"qbasic\", \"qml\", \n  \n  \"r\", \"racket\", \"ragel\", \"react\", \"reasonml\", \"reg\", \"rego\", \"rexx\", \"rpm_spec\", \"rst\", \n  \"ruby\", \"rust\", \n  \n  \"sas\", \"sass\", \"scala\", \"scheme\", \"scilab\", \"scss\", \"sed\", \"sieve\", \"smali\", \"smalltalk\", \n  \"smarty\", \"snobol\", \"solidity\", \"sourcepawn\", \"sparql\", \"sql\", \"squidconf\", \"standard_ml\", \n  \"stas\", \"stylus\", \"swift\", \"systemd\", \"systemverilog\", \n  \n  \"tablegen\", \"tal\", \"tasm\", \"tcl\", \"tcsh\", \"termcap\", \"terminfo\", \"terraform\", \"tex\", \n  \"thrift\",  \"toml\", \"tradingview\", \"transact-sql\", \"turing\", \"turtle\", \"twig\", \"typescript\", \n  \"typoscript\", \"typoscriptcssdata\", \"typoscripthtmldata\", \n  \n  \"ucode\", \n  \n  \"v\", \"v_shell\", \"vala\", \"vb_net\", \"verilog\", \"vhdl\", \"vhs\", \"viml\", \"vue\", \"wdte\", \n  \n  \"webgpu_shading_language\", \"whiley\", \n  \n  \"xml\", \"xorg\", \n  \n  \"yaml\", \"yang\", \"z80_assembly\", \n  \n  \"zed\", \"zig\"\n]\n```\n\nFor details usage, check [tartrazine](https://github.com/ralsina/tartrazine) documents.\n\n## Performance\n\nHere is the result of [a sample markdown file](benchmarks/source.md) parse at MacBook Pro Retina 2015 (2.2 GHz):\n\n```\nCrystal Markdown (no longer present)   3.28k (305.29µs) (± 0.92%)       fastest\n           Markd                       305.36 (  3.27ms) (± 5.52%) 10.73× slower\n```\n\nRecently, I'm working to compare the other popular commonmark parser, the code is stored in [benchmarks](/benchmarks).\n\n## How to Contribute\n\nYour contributions are always welcome! Please submit a pull request or create an issue to add a new question, bug or feature to the list.\n\nAll [Contributors](https://github.com/icyleaf/markd/graphs/contributors) are on the wall.\n\n## You may also like\n\n- [halite](https://github.com/icyleaf/halite) - HTTP Requests Client with a chainable REST API, built-in sessions and middlewares.\n- [totem](https://github.com/icyleaf/totem) - Load and parse a configuration file or string in JSON, YAML, dotenv formats.\n- [poncho](https://github.com/icyleaf/poncho) - A .env parser/loader improved for performance.\n- [popcorn](https://github.com/icyleaf/popcorn) - Easy and Safe casting from one type to another.\n- [fast-crystal](https://github.com/icyleaf/fast-crystal) - 💨 Writing Fast Crystal 😍 -- Collect Common Crystal idioms.\n\n## License\n\n[MIT License](https://github.com/icyleaf/markd/blob/master/LICENSE) © icyleaf\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficyleaf%2Fmarkd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficyleaf%2Fmarkd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficyleaf%2Fmarkd/lists"}