{"id":13493464,"url":"https://github.com/github/cmark-gfm","last_synced_at":"2025-10-04T07:31:42.075Z","repository":{"id":37550021,"uuid":"75244322","full_name":"github/cmark-gfm","owner":"github","description":"GitHub's fork of cmark, a CommonMark parsing and rendering library and program in C","archived":false,"fork":true,"pushed_at":"2024-08-19T05:13:47.000Z","size":6144,"stargazers_count":922,"open_issues_count":121,"forks_count":176,"subscribers_count":50,"default_branch":"master","last_synced_at":"2025-01-20T02:06:23.043Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"commonmark/cmark","license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/github.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.txt","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2016-12-01T01:48:24.000Z","updated_at":"2025-01-16T10:18:26.000Z","dependencies_parsed_at":"2023-09-25T03:34:17.411Z","dependency_job_id":"3f43349a-e9e8-4ab5-833a-aa7a7471fb06","html_url":"https://github.com/github/cmark-gfm","commit_stats":{"total_commits":2496,"total_committers":126,"mean_commits":19.80952380952381,"dds":0.3573717948717948,"last_synced_commit":"587a12bb54d95ac37241377e6ddc93ea0e45439b"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fcmark-gfm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fcmark-gfm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fcmark-gfm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fcmark-gfm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github","download_url":"https://codeload.github.com/github/cmark-gfm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235227462,"owners_count":18956137,"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":[],"created_at":"2024-07-31T19:01:15.461Z","updated_at":"2025-10-04T07:31:36.710Z","avatar_url":"https://github.com/github.png","language":"C","readme":"cmark-gfm\n=========\n\n![Actions CI](https://github.com/github/cmark-gfm/actions/workflows/ci.yml/badge.svg)\n\n`cmark-gfm` is an extended version of the C reference implementation of\n[CommonMark], a rationalized version of Markdown syntax with a spec.  This\nrepository adds GitHub Flavored Markdown extensions to\n[the upstream implementation], as defined in [the spec].\n\nThe rest of the README is preserved as-is from the upstream source.  Note that\nthe library and binaries produced by this fork are suffixed with `-gfm` in\norder to distinguish them from the upstream.\n\n---\n\nIt provides a shared library (`libcmark`) with functions for parsing\nCommonMark documents to an abstract syntax tree (AST), manipulating\nthe AST, and rendering the document to HTML, groff man, LaTeX,\nCommonMark, or an XML representation of the AST.  It also provides a\ncommand-line program (`cmark`) for parsing and rendering CommonMark\ndocuments.\n\nAdvantages of this library:\n\n- **Portable.**  The library and program are written in standard\n  C99 and have no external dependencies.  They have been tested with\n  MSVC, gcc, tcc, and clang.\n\n- **Fast.** cmark can render a Markdown version of *War and Peace* in\n  the blink of an eye (127 milliseconds on a ten year old laptop,\n  vs. 100-400 milliseconds for an eye blink).  In our [benchmarks],\n  cmark is 10,000 times faster than the original `Markdown.pl`, and\n  on par with the very fastest available Markdown processors.\n\n- **Accurate.** The library passes all CommonMark conformance tests.\n\n- **Standardized.** The library can be expected to parse CommonMark\n  the same way as any other conforming parser.  So, for example,\n  you can use `commonmark.js` on the client to preview content that\n  will be rendered on the server using `cmark`.\n\n- **Robust.** The library has been extensively fuzz-tested using\n  [american fuzzy lop].  The test suite includes pathological cases\n  that bring many other Markdown parsers to a crawl (for example,\n  thousands-deep nested bracketed text or block quotes).\n\n- **Flexible.** CommonMark input is parsed to an AST which can be\n  manipulated programmatically prior to rendering.\n\n- **Multiple renderers.**  Output in HTML, groff man, LaTeX, CommonMark,\n  and a custom XML format is supported. And it is easy to write new\n  renderers to support other formats.\n\n- **Free.** BSD2-licensed.\n\nIt is easy to use `libcmark` in python, lua, ruby, and other dynamic\nlanguages: see the `wrappers/` subdirectory for some simple examples.\n\nThere are also libraries that wrap `libcmark` for\n[Go](https://github.com/rhinoman/go-commonmark),\n[Haskell](https://hackage.haskell.org/package/cmark),\n[Ruby](https://github.com/gjtorikian/commonmarker),\n[Lua](https://github.com/jgm/cmark-lua),\n[Perl](https://metacpan.org/release/CommonMark),\n[Python](https://pypi.python.org/pypi/paka.cmark),\n[R](https://cran.r-project.org/package=commonmark),\n[Tcl](https://github.com/apnadkarni/tcl-cmark),\n[Scala](https://github.com/sparsetech/cmark-scala) and\n[Node.js](https://github.com/killa123/node-cmark).\n\nInstalling\n----------\n\nBuilding the C program (`cmark`) and shared library (`libcmark`)\nrequires [cmake].  If you modify `scanners.re`, then you will also\nneed [re2c] \\(\u003e= 0.14.2\\), which is used to generate `scanners.c` from\n`scanners.re`.  We have included a pre-generated `scanners.c` in\nthe repository to reduce build dependencies.\n\nIf you have GNU make, you can simply `make`, `make test`, and `make\ninstall`.  This calls [cmake] to create a `Makefile` in the `build`\ndirectory, then uses that `Makefile` to create the executable and\nlibrary.  The binaries can be found in `build/src`.  The default\ninstallation prefix is `/usr/local`.  To change the installation\nprefix, pass the `INSTALL_PREFIX` variable if you run `make` for the\nfirst time: `make INSTALL_PREFIX=path`.\n\nFor a more portable method, you can use [cmake] manually. [cmake] knows\nhow to create build environments for many build systems.  For example,\non FreeBSD:\n\n    mkdir build\n    cd build\n    cmake ..  # optionally: -DCMAKE_INSTALL_PREFIX=path\n    make      # executable will be created as build/src/cmark\n    make test\n    make install\n\nOr, to create Xcode project files on OSX:\n\n    mkdir build\n    cd build\n    cmake -G Xcode ..\n    open cmark.xcodeproj\n\nThe GNU Makefile also provides a few other targets for developers.\nTo run a benchmark:\n\n    make bench\n\nFor more detailed benchmarks:\n\n    make newbench\n\nTo run a test for memory leaks using `valgrind`:\n\n    make leakcheck\n\nTo reformat source code using `clang-format`:\n\n    make format\n\nTo run a \"fuzz test\" against ten long randomly generated inputs:\n\n    make fuzztest\n\nTo do a more systematic fuzz test with [american fuzzy lop]:\n\n    AFL_PATH=/path/to/afl_directory make afl\n\nFuzzing with [libFuzzer] is also supported but, because libFuzzer is still\nunder active development, may not work with your system-installed version of\nclang. Assuming LLVM has been built in `$HOME/src/llvm/build` the fuzzer can be\nrun with:\n\n    CC=\"$HOME/src/llvm/build/bin/clang\" LIB_FUZZER_PATH=\"$HOME/src/llvm/lib/Fuzzer/libFuzzer.a\" make libFuzzer\n\nTo make a release tarball and zip archive:\n\n    make archive\n\nInstalling (Windows)\n--------------------\n\nTo compile with MSVC and NMAKE:\n\n    nmake\n\nYou can cross-compile a Windows binary and dll on linux if you have the\n`mingw32` compiler:\n\n    make mingw\n\nThe binaries will be in `build-mingw/windows/bin`.\n\nUsage\n-----\n\nInstructions for the use of the command line program and library can\nbe found in the man pages in the `man` subdirectory.\n\nSecurity\n--------\n\nBy default, the library will scrub raw HTML and potentially\ndangerous links (`javascript:`, `vbscript:`, `data:`, `file:`).\n\nTo allow these, use the option `CMARK_OPT_UNSAFE` (or\n`--unsafe`) with the command line program. If doing so, we\nrecommend you use a HTML sanitizer specific to your needs to\nprotect against [XSS\nattacks](http://en.wikipedia.org/wiki/Cross-site_scripting).\n\nContributing\n------------\n\nThere is a [forum for discussing\nCommonMark](http://talk.commonmark.org); you should use it instead of\ngithub issues for questions and possibly open-ended discussions.\nUse the [github issue tracker](http://github.com/commonmark/CommonMark/issues)\nonly for simple, clear, actionable issues.\n\nAuthors\n-------\n\nJohn MacFarlane wrote the original library and program.\nThe block parsing algorithm was worked out together with David\nGreenspan. Vicent Marti optimized the C implementation for\nperformance, increasing its speed tenfold.  Kārlis Gaņģis helped\nwork out a better parsing algorithm for links and emphasis,\neliminating several worst-case performance issues.\nNick Wellnhofer contributed many improvements, including\nmost of the C library's API and its test harness.\n\n[benchmarks]: benchmarks.md\n[the spec]: https://github.github.com/gfm/\n[the upstream implementation]: https://github.com/jgm/cmark\n[CommonMark]: http://commonmark.org\n[cmake]: http://www.cmake.org/download/\n[re2c]: http://re2c.org\n[commonmark.js]: https://github.com/commonmark/commonmark.js\n[Build Status]: https://img.shields.io/travis/github/cmark-gfm/master.svg?style=flat\n[Windows Build Status]: https://ci.appveyor.com/api/projects/status/wv7ifhqhv5itm3d5?svg=true\n[american fuzzy lop]: http://lcamtuf.coredump.cx/afl/\n[libFuzzer]: http://llvm.org/docs/LibFuzzer.html\n","funding_links":[],"categories":["Uncategorized","C"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fcmark-gfm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub%2Fcmark-gfm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fcmark-gfm/lists"}