百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
M

md2man

> 编程语言
开源

将 Markdown 转换为 UNIX 手册页

374 stars0 点赞4 次浏览
访问官网GitHub

工具介绍

将 Markdown 转换为 UNIX 手册页

  • 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 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rubybrowser-basedmanpagesmarkdown-converterterminal-based

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

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