{"id":13580383,"url":"https://github.com/jgm/lunamark","last_synced_at":"2025-07-07T06:10:08.143Z","repository":{"id":661177,"uuid":"304099","full_name":"jgm/lunamark","owner":"jgm","description":"Lua library for conversion between markup formats","archived":false,"fork":false,"pushed_at":"2024-08-10T09:22:43.000Z","size":1233,"stargazers_count":195,"open_issues_count":16,"forks_count":62,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-10-14T15:57:26.870Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","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/jgm.png","metadata":{"files":{"readme":"README.markdown","changelog":"changelog","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":"2009-09-11T14:24:27.000Z","updated_at":"2024-10-03T07:11:53.000Z","dependencies_parsed_at":"2024-08-01T15:34:08.303Z","dependency_job_id":"20e7b6b4-2ea3-4371-b159-078fc3a8770b","html_url":"https://github.com/jgm/lunamark","commit_stats":{"total_commits":836,"total_committers":9,"mean_commits":92.88888888888889,"dds":"0.27511961722488043","last_synced_commit":"ae3091ad9f0e2cb3cea2571663b2c39e508bf5a7"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgm%2Flunamark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgm%2Flunamark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgm%2Flunamark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jgm%2Flunamark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jgm","download_url":"https://codeload.github.com/jgm/lunamark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247608151,"owners_count":20965952,"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-08-01T15:01:50.398Z","updated_at":"2025-04-07T07:06:59.184Z","avatar_url":"https://github.com/jgm.png","language":"C","funding_links":[],"categories":["C","资源","Resources"],"sub_categories":["Parsing and Serialization"],"readme":"# Lunamark\n\nLunamark is a lua library and command-line program for conversion of markdown\nto other textual formats. Currently HTML, [dzslides] (HTML5 slides),\nDocbook, ConTeXt, LaTeX, and Groff man are the supported output formats, but\nit is easy to add new writers or modify existing ones. The markdown parser is\nwritten using a PEG grammar and can also be modified by the user.\n\nThe library is as portable as lua and has very good performance.\nIt is roughly as fast as the author's own C library\n[peg-markdown](https://github.com/jgm/peg-markdown),\ntwo orders of magnitude faster than `Markdown.pl`,\nand three orders of magnitude faster than `markdown.lua`.\n\n# Links\n\n+ [Source code repository]\n+ [Issue tracker]\n+ [Website]\n+ [API documentation]\n+ [lunamark(1)]\n+ [lunadoc(1)]\n\n[Source code repository]: https://github.com/jgm/lunamark\n[Issue tracker]: https://github.com/jgm/lunamark/issues\n[Website]: https://jgm.github.io/lunamark\n[API documentation]: https://jgm.github.io/lunamark/doc/\n[lunamark(1)]: https://jgm.github.io/lunamark/lunamark.1.html\n[lunadoc(1)]: https://jgm.github.io/lunamark/lunadoc.1.html\n[dzslides]: https://paulrouget.com/dzslides/\n\n# Extensions\n\nLunamark's markdown parser currently supports a number of extensions\n(which can be turned on or off individually), including:\n\n  - Smart typography (fancy quotes, dashes, ellipses)\n  - Significant start numbers in ordered lists\n  - Footnotes (both regular and inline)\n  - Definition lists\n  - Pandoc-style title blocks\n  - Pandoc-style citations\n  - Fenced code blocks\n  - Flexible metadata using lua declarations\n\nSee the [lunamark(1)] man page for a complete list.\n\nIt is very easy to extend the library by modifying the writers,\nadding new writers, and even modifying the markdown parser. Some\nsimple examples are given in the [API documentation].\n\n# Benchmarks\n\nGenerated with\n\n    PROG=$program make bench\n\nThis converts the input files from the original markdown test suite\nconcatenated together 25 times.\n\n         0.04s   sundown\n         0.15s   discount\n    -\u003e   0.56s   lunamark + luajit\n         0.80s   peg-markdown\n    -\u003e   0.97s   lunamark\n         4.05s   PHP Markdown\n         6.11s   pandoc\n       113.13s   Markdown.pl\n      2322.33s   markdown.lua\n\n# Installing\n\nIf you want a standalone version of lunamark that doesn't\ndepend on lua or other lua modules being installed on\nyour system, just do\n\n    make standalone\n\nYour executable will be created in the `standalone`\ndirectory.\n\nIf you are a lua user, you will probably prefer to install\nlunamark using luarocks.  You can install the latest development\nversion this way:\n\n    git clone http://github.com/jgm/lunamark.git\n    cd lunamark\n    luarocks make\n\nReleased versions will be uploaded to the luarocks\nrepository, so you should be able to install them using:\n\n    luarocks install lunamark\n\nThere may be a short delay between the release and the\nluarocks upload.\n\n# Using the library\n\nSimple usage example:\n\n    local lunamark = require(\"lunamark\")\n    local opts = { }\n    local writer = lunamark.writer.html.new(opts)\n    local parse = lunamark.reader.markdown.new(writer, opts)\n    print(parse(\"Here's my *text*\"))\n\nFor more examples, see [API documentation].\n\n# lunamark\n\nThe `lunamark` executable allows easy markdown conversion from the command\nline.  For usage instructions, see the [lunamark(1)] man page.\n\n# lunadoc\n\nLunamark comes with a simple lua library documentation tool, `lunadoc`.\nFor usage instructions, see the [lunadoc(1)] man page.\n`lunadoc` reads source files and parses specially marked markdown\ncomment blocks.  [Here][API documentation] is an example of the result.\n\n# Tests\n\nThe source directory contains a large test suite in `tests`.\nThis includes existing Markdown and PHP Markdown tests, plus more\ntests for lunamark-specific features and additional corner cases.\n\nTo run the tests, use `bin/shtest`.\n\n    bin/shtest --help            # get usage\n    bin/shtest                   # run all tests\n    bin/shtest indent            # run all tests matching \"indent\"\n    bin/shtest -p Markdown.pl -t # run all tests using Markdown.pl, and normalize using 'tidy'\n\nLunamark currently fails four of the PHP Markdown tests:\n\n  * `tests/PHP_Markdown/Quotes in attributes.test`: The HTML is\n    semantically equivalent; using the `-t/--tidy` option to `bin/shtest` makes\n    the test pass.\n\n  * `tests/PHP_Markdown/Email auto links.test`: The HTML is\n    semantically equivalent. PHP markdown does entity obfuscation, and\n    lunamark does not. This feature could be added easily enough, but the test\n    would still fail, because the obfuscation involves randomness. Again,\n    using the `-t/--tidy` option makes the test pass.\n\n  * `tests/PHP_Markdown/Ins \u0026 del.test`:  PHP markdown puts extra `\u003cp\u003e`\n    tags around `\u003cins\u003ehello\u003c/ins\u003e`, while lunamark does not.  It's hard\n    to tell from the markdown spec which behavior is correct.\n\n  * `tests/PHP_Markdown/Emphasis.test`:  A bunch of corner cases with nested\n    strong and emphasized text.  These corner cases are left undecided by\n    the markdown spec, so in my view the PHP test suite is not normative here;\n    I think lunamark's behavior is perfectly reasonable, and I see no reason\n    to change.\n\nThe `make test` target only runs the Markdown and lunamark\ntests, skipping the PHP Markdown tests.\n\n# Authors\n\nlunamark is released under the MIT license.\n\nMost of the library is written by John MacFarlane.  Hans Hagen\nmade some major performance improvements.  Khaled Hosny added the\noriginal ConTeXt writer.\n\nThe [dzslides] HTML, CSS, and javascript code is by Paul Rouget, released under\nthe DWTFYWT Public License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgm%2Flunamark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjgm%2Flunamark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjgm%2Flunamark/lists"}