Giter Club home page Giter Club logo

remark-man's Introduction

remark-man

Build Coverage Downloads Chat Sponsors Backers

Compile markdown to man pages with remark. Great unicode support; name, section, and description detection; nested block quotes and lists; tables; and much more.

Installation

npm:

npm install remark-man

Usage

Say we have the following file, example.md:

# ls(1) -- list directory contents

## SYNOPSIS

`ls` [`-ABCFGHLOPRSTUW@abcdefghiklmnopqrstuwx1`] \[_file_ _..._]

And our script, example.js, looks as follows:

var vfile = require('to-vfile')
var unified = require('unified')
var markdown = require('remark-parse')
var man = require('remark-man')

unified()
  .use(markdown)
  .use(man)
  .process(vfile.readSync('example.md'), function(err, file) {
    if (err) throw err
    file.extname = '.1'
    vfile.writeSync(file)
  })

Now, running node example and cat example.1 yields:

.TH "LS" "1" "June 2015" "" ""
.SH "NAME"
\fBls\fR - list directory contents
.SH "SYNOPSIS"
.P
\fBls\fR \fB\fB-ABCFGHLOPRSTUW@abcdefghiklmnopqrstuwx1\fR\fR \[lB]\fIfile\fR \fI...\fR\[rB]

Now, that looks horrible, but that’s how roff/groff/troff are πŸ˜‰.

To properly view that man page, use something like this: man ./example.1.

remark.use(man[, options])

Compile markdown to a man page.

Options
name

string, optional β€” Title of the page. Is inferred from the main heading: # hello-world(7) sets name to 'hello-world'; or from the file’s name: hello-world.1.md sets name to 'hello-world'.

section

number or string, optional β€” Section of page. Is inferred from the main heading: # hello-world(7) sets section to 7; or from the file’s name: hello-world.1.md sets section to 1.

description

string, optional β€” Description of page. Is inferred from the main heading: # hello-world(7) -- Two common words sets description to 'Two common words'.

date

number, string, or Date, optional β€” Date of page. Given to new Date(date) as date, so when null or undefined, defaults to the current date. Dates are centred in the footer line of the displayed page.

version

string, optional β€” Version of page. Versions are positioned at the left of the footer line of the displayed page (or at the left on even pages and at the right on odd pages if double-sided printing is active).

manual

string, optional β€” Manual of page. Manuals are centred in the header line of the displayed page.

commonmark

Set to true (default: false) to prefer the first when duplicate definitions are found. The default behaviour is to prefer the last duplicate definition.

Related

Contribute

See contributing.md in remarkjs/remark for ways to get started.

This organisation has a Code of Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT Β© Titus Wormer

remark-man's People

Contributors

wooorm avatar eush77 avatar greenkeeperio-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.