All Projects → sunaku → Md2man

sunaku / Md2man

Licence: other
📚 Converts markdown into UNIX manual pages

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Md2man

ash
A modern terminal text editor
Stars: ✭ 37 (-89.02%)
Mutual labels:  terminal-based
nchat
Terminal-based Telegram client for Linux and macOS
Stars: ✭ 68 (-79.82%)
Mutual labels:  terminal-based
Pydoro
🍅 pydoro - Terminal Pomodoro Timer
Stars: ✭ 277 (-17.8%)
Mutual labels:  terminal-based
slackify-markdown
Convert markdown into Slack-specific markdown
Stars: ✭ 80 (-76.26%)
Mutual labels:  markdown-converter
zk
A note-taking tool based on the famous Zettelkasten method
Stars: ✭ 41 (-87.83%)
Mutual labels:  terminal-based
literator
📝 Generate literate-style markdown docs from your sources
Stars: ✭ 55 (-83.68%)
Mutual labels:  markdown-converter
stui
A Slurm dashboard for the terminal.
Stars: ✭ 36 (-89.32%)
Mutual labels:  terminal-based
Kod
terminal text editor written in Go, using xi-editor as backend
Stars: ✭ 292 (-13.35%)
Mutual labels:  terminal-based
Pi-CLI
Pi-Hole data right from your terminal. Live updating view, query history extraction and more!
Stars: ✭ 40 (-88.13%)
Mutual labels:  terminal-based
Colorpedia
Command-line tool for looking up colors and palettes.
Stars: ✭ 255 (-24.33%)
Mutual labels:  terminal-based
vocage
A minimalistic spaced-repetion vocabulary trainer (flashcards) for the terminal
Stars: ✭ 68 (-79.82%)
Mutual labels:  terminal-based
fireplace
A cozy fireplace in your terminal
Stars: ✭ 52 (-84.57%)
Mutual labels:  terminal-based
jekyll-commonmark
CommonMark generator for Jekyll
Stars: ✭ 28 (-91.69%)
Mutual labels:  markdown-converter
Turn
Hacktkober 'n' Slash (C++ turn-based RPG game)
Stars: ✭ 51 (-84.87%)
Mutual labels:  terminal-based
Upndown
HTML to Markdown javascript converter
Stars: ✭ 278 (-17.51%)
Mutual labels:  markdown-converter
markdown articles tool
Parse markdown article, download images and replace images URL's with local paths
Stars: ✭ 37 (-89.02%)
Mutual labels:  markdown-converter
Zeus
🔭 A modern cross platform `ls` with powerful searching and querying capabilities to scale your productivity to the moon 🚀 (and yeah it has file explorer like capabilities too 🤫)
Stars: ✭ 75 (-77.74%)
Mutual labels:  terminal-based
Spotui
Spotify in the terminal 💻🎶
Stars: ✭ 302 (-10.39%)
Mutual labels:  terminal-based
Pyshelf
A simple terminal based ebook server
Stars: ✭ 281 (-16.62%)
Mutual labels:  terminal-based
c games
[Some C games] Some simple games written in C language.
Stars: ✭ 31 (-90.8%)
Mutual labels:  terminal-based

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:

md2man-roff EXAMPLE.markdown > EXAMPLE.1

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

man -l EXAMPLE.1

screenshot

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

md2man-html EXAMPLE.markdown > EXAMPLE.html

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

firefox EXAMPLE.html

Installation

gem install md2man

Development

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:

md2man-roff --help

Inside a Ruby script

Use the default renderer:

require 'md2man/roff/engine'

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

Build your own renderer:

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:

require 'md2man/roff/engine'

class YourManpageRenderer < Md2Man::Roff::Engine
  # ... your stuff here ...
end

engine = Redcarpet::Markdown.new(YourManpageRenderer, your_options_hash)
your_roff_output = engine.render(your_markdown_input)

Mix-in your own renderer:

require 'md2man/roff'

class YourManpageRenderer < Redcarpet::Render::Base
  include Md2Man::Roff
  # ... your stuff here ...
end

engine = Redcarpet::Markdown.new(YourManpageRenderer, your_options_hash)
your_roff_output = engine.render(your_markdown_input)

For HTML output

At the command line

See md2man-html(1) manual:

md2man-html --help

Inside a Ruby script

Use the default renderer:

require 'md2man/html/engine'

your_html_output = Md2Man::HTML::ENGINE.render(your_markdown_input)

Build your own renderer:

require 'md2man/html/engine'

engine = Redcarpet::Markdown.new(Md2Man::HTML::Engine, your_options_hash)
your_html_output = engine.render(your_markdown_input)

Define your own renderer:

require 'md2man/html/engine'

class YourManpageRenderer < Md2Man::HTML::Engine
  # ... your stuff here ...
end

engine = Redcarpet::Markdown.new(YourManpageRenderer, your_options_hash)
your_html_output = engine.render(your_markdown_input)

Mix-in your own renderer:

require 'md2man/html'

class YourManpageRenderer < Redcarpet::Render::Base
  include Md2Man::HTML
  # ... your stuff here ...
end

engine = Redcarpet::Markdown.new(YourManpageRenderer, your_options_hash)
your_html_output = engine.render(your_markdown_input)

Building manpages

At the command line

See md2man-rake(1) manual:

md2man-rake --help

Inside a Ruby script

Add this snippet to your gemspec file:

s.files += Dir['man/man?/*.?']         # UNIX manpages
s.files += Dir['man/**/*.{html,css}']  # HTML manpages
s.add_development_dependency 'md2man', '~> 5.0'

Add this line to your Rakefile:

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:

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

License

Like my work? 👍 Please spare a life today as thanks! 🐮🐷🐔🐟🙊✌️💞

Copyright 2011 Suraj N. Kurapati https://github.com/sunaku

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].