{"id":13463181,"url":"https://github.com/sunaku/md2man","last_synced_at":"2025-04-12T19:48:17.395Z","repository":{"id":1746834,"uuid":"2572845","full_name":"sunaku/md2man","owner":"sunaku","description":"📚 Converts markdown into UNIX manual pages","archived":false,"fork":false,"pushed_at":"2018-02-04T18:45:44.000Z","size":517,"stargazers_count":373,"open_issues_count":3,"forks_count":22,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-12T19:48:14.086Z","etag":null,"topics":["browser-based","manpages","markdown-converter","terminal-based"],"latest_commit_sha":null,"homepage":"https://sunaku.github.io/md2man/man","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunaku.png","metadata":{"files":{"readme":"README.markdown","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":"2011-10-13T22:21:03.000Z","updated_at":"2025-04-09T18:12:15.000Z","dependencies_parsed_at":"2022-08-20T22:31:03.456Z","dependency_job_id":null,"html_url":"https://github.com/sunaku/md2man","commit_stats":null,"previous_names":[],"tags_count":37,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunaku%2Fmd2man","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunaku%2Fmd2man/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunaku%2Fmd2man/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunaku%2Fmd2man/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunaku","download_url":"https://codeload.github.com/sunaku/md2man/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248625498,"owners_count":21135513,"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":["browser-based","manpages","markdown-converter","terminal-based"],"created_at":"2024-07-31T13:00:47.477Z","updated_at":"2025-04-12T19:48:17.375Z","avatar_url":"https://github.com/sunaku.png","language":"Ruby","readme":"* Code: \u003chttps://github.com/sunaku/md2man\u003e\n* Docs: \u003chttps://sunaku.github.io/md2man/man\u003e\n* Bugs: \u003chttps://github.com/sunaku/md2man/issues\u003e\n\n# md2man - markdown to manpage\n\nmd2man is a Ruby library and a set of command-line programs that convert\n[Markdown] into UNIX manpages as well as HTML webpages using [Redcarpet].\n\n## Features\n\n  * Formats indented, tagged, and normal paragraphs: described in md2man(5).\n\n  * Translates all HTML4 and XHTML1 entities into native [roff] equivalents.\n\n  * Supports markdown extensions such as [PHP Markdown Extra tables][tables].\n\n  * Usable from the command line as a filter in a UNIX command pipeline.\n\n### Examples\n\nTry converting\n[this example Markdown file][example]\ninto\n[a UNIX manual page][example-roff]:\n\n```sh\nmd2man-roff EXAMPLE.markdown \u003e EXAMPLE.1\n```\n\nYou can view [the resulting UNIX manual page][example-roff] in your man(1)\nviewer:\n\n```sh\nman -l EXAMPLE.1\n```\n\n![screenshot](https://github.com/sunaku/md2man/raw/gh-pages/EXAMPLE.png)\n\nNext, try converting\n[the same example file][example]\ninto\n[a HTML web page][example-html]:\n\n```sh\nmd2man-html EXAMPLE.markdown \u003e EXAMPLE.html\n```\n\nYou can view [the resulting HTML manual page][example-html] in your web\nbrowser:\n\n```sh\nfirefox EXAMPLE.html\n```\n\n[example]: https://raw.github.com/sunaku/md2man/master/EXAMPLE.markdown\n[example-roff]: https://github.com/sunaku/md2man/raw/gh-pages/man/man0/EXAMPLE\n[example-html]: https://sunaku.github.io/md2man/man/man0/EXAMPLE.html\n\n## Installation\n\n```sh\ngem install md2man\n```\n\n### Development\n\n```sh\ngit clone https://github.com/sunaku/md2man\ncd md2man\nbundle install\nbundle exec rake --tasks        # packaging tasks\nbundle exec md2man-roff --help  # run it directly\nbundle exec md2man-html --help  # run it directly\n```\n\n## Usage\n\n### For [roff] output\n\n#### At the command line\n\nSee md2man-roff(1) manual:\n\n```sh\nmd2man-roff --help\n```\n\n#### Inside a Ruby script\n\nUse the default renderer:\n\n```ruby\nrequire 'md2man/roff/engine'\n\nyour_roff_output = Md2Man::Roff::ENGINE.render(your_markdown_input)\n```\n\nBuild your own renderer:\n\n```ruby\nrequire 'md2man/roff/engine'\n\nengine = Redcarpet::Markdown.new(Md2Man::Roff::Engine, your_options_hash)\nyour_roff_output = engine.render(your_markdown_input)\n```\n\nDefine your own renderer:\n\n```ruby\nrequire 'md2man/roff/engine'\n\nclass YourManpageRenderer \u003c Md2Man::Roff::Engine\n  # ... your stuff here ...\nend\n\nengine = Redcarpet::Markdown.new(YourManpageRenderer, your_options_hash)\nyour_roff_output = engine.render(your_markdown_input)\n```\n\nMix-in your own renderer:\n\n```ruby\nrequire 'md2man/roff'\n\nclass YourManpageRenderer \u003c Redcarpet::Render::Base\n  include Md2Man::Roff\n  # ... your stuff here ...\nend\n\nengine = Redcarpet::Markdown.new(YourManpageRenderer, your_options_hash)\nyour_roff_output = engine.render(your_markdown_input)\n```\n\n### For HTML output\n\n#### At the command line\n\nSee md2man-html(1) manual:\n\n```sh\nmd2man-html --help\n```\n\n#### Inside a Ruby script\n\nUse the default renderer:\n\n```ruby\nrequire 'md2man/html/engine'\n\nyour_html_output = Md2Man::HTML::ENGINE.render(your_markdown_input)\n```\n\nBuild your own renderer:\n\n```ruby\nrequire 'md2man/html/engine'\n\nengine = Redcarpet::Markdown.new(Md2Man::HTML::Engine, your_options_hash)\nyour_html_output = engine.render(your_markdown_input)\n```\n\nDefine your own renderer:\n\n```ruby\nrequire 'md2man/html/engine'\n\nclass YourManpageRenderer \u003c Md2Man::HTML::Engine\n  # ... your stuff here ...\nend\n\nengine = Redcarpet::Markdown.new(YourManpageRenderer, your_options_hash)\nyour_html_output = engine.render(your_markdown_input)\n```\n\nMix-in your own renderer:\n\n```ruby\nrequire 'md2man/html'\n\nclass YourManpageRenderer \u003c Redcarpet::Render::Base\n  include Md2Man::HTML\n  # ... your stuff here ...\nend\n\nengine = Redcarpet::Markdown.new(YourManpageRenderer, your_options_hash)\nyour_html_output = engine.render(your_markdown_input)\n```\n\n### Building manpages\n\n#### At the command line\n\nSee md2man-rake(1) manual:\n\n```sh\nmd2man-rake --help\n```\n\n#### Inside a Ruby script\n\nAdd this snippet to your gemspec file:\n\n```ruby\ns.files += Dir['man/man?/*.?']         # UNIX manpages\ns.files += Dir['man/**/*.{html,css}']  # HTML manpages\ns.add_development_dependency 'md2man', '~\u003e 5.0'\n```\n\nAdd this line to your Rakefile:\n\n```ruby\nrequire 'md2man/rakefile'\n```\n\nYou now have a `rake md2man` task that builds manual pages from Markdown files\n(with \".markdown\", \".mkd\", or \".md\" extension) inside `man/man*/` directories.\nThere are also sub-tasks to build manual pages individually as [roff] or HTML.\n\nIf you're using Bundler, this task also hooks into Bundler's gem packaging\ntasks and ensures that your manual pages are built for packaging into a gem:\n\n```ruby\nbundle exec rake build\ngem spec pkg/*.gem | fgrep man/\n```\n\n## License\n\n[Spare A Life]: https://sunaku.github.io/vegan-for-life.html\n\u003e Like my work? :+1:  Please [spare a life] today as thanks!\n:cow::pig::chicken::fish::speak_no_evil::v::revolving_hearts:\n\nCopyright 2011 Suraj N. Kurapati \u003chttps://github.com/sunaku\u003e\n\nReleased under the ISC license.  See the LICENSE file for details.\n\n[roff]: http://troff.org\n[Redcarpet]: https://github.com/vmg/redcarpet\n[Markdown]: http://daringfireball.net/projects/markdown/\n[tables]: http://michelf.com/projects/php-markdown/extra/#table\n","funding_links":[],"categories":["Documentation Tools","Ruby","Happy Exploring 🤘"],"sub_categories":["Documentation Generators"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunaku%2Fmd2man","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunaku%2Fmd2man","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunaku%2Fmd2man/lists"}