Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
M

md2man

> 编程语言
Open source

Converts markdown into UNIX manual pages

374 stars0 likes4 views
WebsiteGitHub

About

Converts markdown into UNIX manual pages

  • Code:
  • Docs:
  • Bugs:

md2man - markdown to manpage

md2man is a Ruby library and a set of command-line programs that convert Markdown into UNIX manpages as well as HTML webpages using Redcarpet.

Features

  • Formats indented, tagged, and normal paragraphs: described in md2man(5).

  • Translates all HTML4 and XHTML1 entities into native roff equivalents.

  • Supports markdown extensions such as PHP Markdown Extra tables.

  • Usable from the command line as a filter in a UNIX command pipeline.

Examples

Try converting this example Markdown file into a UNIX manual page:

bash
md2man-roff EXAMPLE.markdown > EXAMPLE.1

You can view the resulting UNIX manual page in your man(1) viewer:

bash
man -l EXAMPLE.1

Next, try converting the same example file into a HTML web page:

bash
md2man-html EXAMPLE.markdown > EXAMPLE.html

You can view the resulting HTML manual page in your web browser:

bash
firefox EXAMPLE.html

Installation

bash
gem install md2man

Development

bash
git clone https://github.com/sunaku/md2man
cd md2man
bundle install
bundle exec rake --tasks        # packaging tasks
bundle exec md2man-roff --help  # run it directly
bundle exec md2man-html --help  # run it directly

Usage

For roff output

At the command line

See md2man-roff(1) manual:

bash
md2man-roff --help

Inside a Ruby script

Use the default renderer:

ruby
require 'md2man/roff/engine'

your_roff_output = Md2Man::Roff::ENGINE.render(your_markdown_input)

Build your own renderer:

ruby
require 'md2man/roff/engine'

engine = Redcarpet::Markdown.new(Md2Man::Roff::Engine, your_options_hash)
your_roff_output = engine.render(your_markdown_input)

Define your own renderer:

ruby
require 'md2man/roff/engine'

class YourManpageRenderer  5.0'

Add this line to your Rakefile:

ruby
require 'md2man/rakefile'

You now have a rake md2man task that builds manual pages from Markdown files (with ".markdown", ".mkd", or ".md" extension) inside man/man*/ directories. There are also sub-tasks to build manual pages individually as roff or HTML.

If you're using Bundler, this task also hooks into Bundler's gem packaging tasks and ensures that your manual pages are built for packaging into a gem:

ruby
bundle exec rake build
gem spec pkg/*.gem | fgrep man/

License

Like my work? :+1: Please spare a life today as thanks! :cow::pig::chicken::fish::speak_no_evil::v::revolving_hearts:

Copyright 2011 Suraj N. Kurapati

Released under the ISC license. See the LICENSE file for details.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rubybrowser-basedmanpagesmarkdown-converterterminal-based

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言