the opposite of roff

Related tags

Documentation ronn
Overview

Ronn

Ronn builds manuals. It converts simple, human readable textfiles to roff for terminal display, and also to HTML for the web.

The source format includes all of Markdown but has a more rigid structure and syntax extensions for features commonly found in manpages (definition lists, link notation, etc.). The ronn-format(7) manual page defines the format in detail.

The *.ronn files found in the man/ directory show off a wide range of ronn capabilities:

As an alternative, you might want to check out pandoc which can also convert markdown into roff manual pages.

Examples

Build roff and HTML output files for one or more input files:

$ ronn man/ronn.5.ronn
roff: man/ronn.5
html: man/ronn.5.html

Generate only a standalone HTML version of one or more files:

$ ronn --html man/markdown.5.ronn
html: man/markdown.5.html

Build roff versions of all ronn files in a directory:

$ ronn --roff man/*.ronn

View a ronn file as if it were a manpage without building intermediate files:

$ ronn --man man/markdown.5.ronn

View roff output with man(1):

$ man man/ronn.5

The ronn(1) manual page includes comprehensive documentation on ronn command line options.

Background

Some think UNIX manual pages are a poor and outdated form of documentation. I disagree:

  • Manpages follow a well defined structure that's immediately familiar. This gives developers a starting point when documenting new tools, libraries, and formats.

  • Manpages get to the point. Because they're written in an inverted style, with a SYNOPSIS section followed by additional detail, prose and references to other sources of information, manpages provide the best of both cheat sheet and reference style documentation.

  • Historically, manpages use an extremely -- unbelievably -- limited set of text formatting capabilities. You get a couple of headings, lists, bold, underline and no more. This is a feature.

  • Although two levels of section hierarchy are technically supported, most manpages use only a single level. Unwieldy document hierarchies complicate otherwise good documentation. Remember that Feynman covered all of physics -- heavenly bodies through QED -- with only two levels of document hierarchy (The Feynman Lectures on Physics, 1970).

  • The classical terminal manpage display is typographically well thought out. Big bold section headings, justified monospace text, nicely indented paragraphs, intelligently aligned definition lists, and an informational header and footer.

  • Manpages have a simple referencing syntax; e.g., sh(1), fork(2), markdown(7). HTML versions can use this to generate links between pages.

Unfortunately, figuring out how to create a manpage is a fairly tedious process. The roff/mandoc/mdoc macro languages are highly extensible, fractured between multiple dialects, and include a bunch of device specific stuff irrelevant to modern publishing tools.

Copying

Ronn is Copyright (C) 2010 Ryan Tomayko
See the file COPYING for information of licensing and distribution.

Comments
  • blank lines squashed in <pre> blocks in Roff output

    blank lines squashed in
     blocks in Roff output
    	                                    
    

    I have an implicit Markdown <pre> block (created by 4 space prefix) containing blank lines (which still have the 4 space prefix). In Ronn 0.5's HTML output, the blank lines are preserved correctly, but in the Roff output, the blank lines are squashed into a single blank line.

    bug 
    opened by sunaku 5
  • Publish to rubyforge

    Publish to rubyforge

    Hey,

    I recently upgraded ruby with rvm and did a gemset copy and have lost the changes I implemented as patches (it makes the gemset pristine), symbolic linking to the ronn executable in my local repository does not appear to work.

    Would you be so kind as to publish an updated gem?

    Cheers!

    opened by tmpfs 4
  • Allow `page`(section) to work with link indexes

    Allow `page`(section) to work with link indexes

    I like to write references to other manual pages as page(section) because this comes closest in both raw Markdown (as seen on GitHub) and non-linked Roff output to the visual style of most standard manual pages. Specifically, that the page name is shown bold (or in my terminal's case, colored) and the section is not.

    Desired: http://devstructure.github.com/contractor/blueprint-create.1.html Close, but no cigar: http://devstructure.github.com/doubledown/doubledown.1.html

    opened by rcrowley 4
  • ronn fails to generate code block containing doublequote (

    ronn fails to generate code block containing doublequote (") character

    Just try to generate manpage from the following file: t(1) - test ===========

    ## test
    
        [ "$11" ]
    

    Note that, html is generated correctly.

    opened by pawelz 4
  • Change \(bu to \[ci] for utf8 encoding

    Change \(bu to \[ci] for utf8 encoding

    This may seem a little strange, it's more aesthetic then anything else. When troff is run with -Kutf8 -Tutf8 to ensure that utf8 characters appear correctly then the bullets generated by \(bu appear as small squares (I'm using 13pt Pragmata Pro).

    My suggestion is that the \[ci] marker is used so that bullets are always formatted nicely. This does not affect the html output of course. Trivial patch below:

    --- roff.rb 2013-02-09 23:25:00.000000000 +0100
    +++ roff.rb.new 2013-02-09 23:25:25.000000000 +0100
    @@ -141,7 +141,7 @@
               when 'ol'
                 macro "IP", %W["#{node.position + 1}." 4]
               when 'ul'
    -            macro "IP", %w["\(bu" 4]
    +            macro "IP", %w["\\\[ci\]" 4]
               end
               if node.at('p|ol|ul|dl|div')
                 block_filter(node.children)
    

    I'd rather do this in troffrc but have been unable to work out how to map \(bu to another character :(

    Thanks for merging the other patch!

    opened by tmpfs 3
  • Ellipses (...) at start of line are not properly escaped in roff

    Ellipses (...) at start of line are not properly escaped in roff

    Steps to reproduce:

        $ curl -sO https://github.com/defunkt/hub/raw/c2e575fa/man/hub.1.ronn
        $ ronn hub.1.ronn &> /dev/null
        $ man --warnings -l hub.1 >/dev/null
        <standard input>:228: warning: macro `..' not defined
        $
    

    Also, if you use man to view the generated manpage, the "hardcore forking action" is completely missing:

        $ groff -T ascii ./hub.1 | grep hardcore
        $
    

    The correct way to display ellipses in roff is something like this: |.|.|.

    (An example for this can be seen in the source for the nroff(1) manpage.)

    opened by sometimesfood 3
  • broken roff output

    broken roff output

    Just an example of input file that is not rendered correctly:

    a(1)
    ====
    
    * `toggle_status`
      - Toggle the display of the status bar.
    * `spawn <executable> <additional args>` TODO explain path-alike expansion
    

    I'm getting warn: unrecognized block tag: "code" message and broken man output. HTML looks ok.

    Note that the following input file renders correctly:

    a(1)
    ====
    
    * `abc`
      - def
    
    * `toggle_status`
      - Toggle the display of the status bar.
    * `spawn <executable> <additional args>` TODO explain path-alike expansion
    
    roff 
    opened by pawelz 3
  • Make man section TOC optional

    Make man section TOC optional

    There's now a right-side TOC included by default in HTML output, courtesy of sunaku. Example here.

    I'd like to add an option to the ronn command that would disable this for the simple, non-TOC display.

    There's also some issues with page width, especially with code examples and preformatted blocks. I'd like to consider using a non-fixed layout and maybe moving it over to the left. The man.cx layout and node.js manual are good examples of what alternative takes on a TOC.

    For now, we ought to get a basic option in for turning the TOC off and then we can address some of the other stuff with custom layouts when that lands.

    html 
    opened by rtomayko 3
  • name field should have only one dash

    name field should have only one dash

    All the manpages I see in Linux have only one dash separating the subject from the tagline:

    man - an interface to the on-line reference manuals
    cat - concatenate files and print on the standard output
    sh - shell, the standard command language interpreter
    

    But Ronn 0.5 forces two dashes (even if I write a single dash). Shouldn't it follow prior convention?

    opened by sunaku 3
  • Escaping of chars between < >

    Escaping of chars between < >

    Since 0.4 ronn escapes the letters between < > and the result looks like garbage in manpages. Maybe this is caused by rdiscount, but still it's not what I expect to see in a manpage.

    Example:

    % cat foo.1.ron

    ## Foobar
    
    Random junk
    
    ## Bugreport
    
    Report bugs to <[email protected]>
    

    % cat foo.1

    
    .\" generated with Ronn/v0.4.1
    .\" http://github.com/rtomayko/ronn/
    .
    .TH "FOO" "1" "March 2010" "" ""
    .
    .SH "NAME"
    \fBfoo\fR \-\-
    .
    .SH "Foobar"
    Random junk
    .
    .SH "Bugreport"
    Report bugs to \fI&#100;&#x75;&#109;&#x6d;&#x79;&#64;&#x65;&#109;&#97;&#x69;&#x6c;&#46;&#99;&#x6f;&#109;\fR
    
    opened by unexist 3
  • Paragraph in source not in output

    Paragraph in source not in output

    When running the following example through ron, the middle paragraph (“Always use…”) is ommited from the output. This happens with both manpage output as HTML output.

    test(1) -- just a ron test
    ==========================
    
    ## TEST
    
    Foo
    
    Always use `attr_reader`, `attr_writer` or `attr_accessor`. Do not use `for...in`; use each instead. Do not use `and`/`or`; use `&&`/`||` instead.
    
    Bar
    

    This results in a HTML page or man page that looks somewhat like this:

    TEST
            Foo
    
            Bar
    

    When leaving out the last paragraph (Bar), the missing paragraph turns up.

    opened by denisdefreyne 3
  • Is this project dead?

    Is this project dead?

    There is no new activity on this project since 7 years, there are 14 pending pull request and many unanswered issues.

    I would like to know if the maintainer plans to work on this project again. If not, could this project be put as archived, or transferred to someone else interested to maintain it?

    Also, is there an interesting fork to follow, or other alternative tools? I'm trying Pandoc but it's heavy compared to ronn.

    opened by roipoussiere 1
  • Add Dockerfile

    Add Dockerfile

    This PR adds a Dockerfile based on Alpine.

    A ronn Dockerfile is useful for Continuous Integration tools (such as GitLab CI), to automatically generate a man page during a build process.

    This Dockerfile is currently hosted on Docker hub. If this PR is merged, I can transfer ownship to an other Docker hub user or organization.

    Usage

    I recommend to use this container with stdin and stdout, in this way we don't have to deal with Docker volumes.

    Saving ./my_program.1.ronn manpage to ./my_program.1:

    docker run --rm -i roipoussiere/ronn --roff --pipe < ./my_program.1.ronn > ./my_program.1
    

    Saving ./my_program.1.ronn html manpage to ./my_program.1.html:

    docker run --rm -i roipoussiere/ronn --html --pipe < ./my_program.1.ronn > ./my_program.1.html
    

    Usage in CI

    The image entrypoint must be overridden in your CI tool. For instance, if GitLab CI is used, the .gitlab-ci.yml could look like this:

    man:
      image:
        name: roipoussiere/ronn
        entrypoint: ["/bin/sh", "-c"]
      script:
        - ronn --roff --pipe ./my_script.1.ronn > ./my_script.1.ronn
        - ronn --html --pipe ./my_script.1.ronn > ./my_script.1.html
    
    opened by roipoussiere 0
  • Incorrect attributes in generated `meta` tags

    Incorrect attributes in generated `meta` tags

    In the HTML output, there are a couple meta tags being generated by Ronn.

      <meta http-equiv='content-type' value='text/html;charset=utf8'>
      <meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
    

    I think these are invalid. The meta element doesn't take a name attribute; it takes a content attribute instead. These should be:

      <meta http-equiv='content-type' content='text/html;charset=utf8'>
      <meta name='generator' content='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
    
    opened by apjanke 2
  • Cannot render circumflex

    Cannot render circumflex

    The following Markdown snippet contains a circumflex but it is discarded in the conversion to roff. There does not appear to be a way to render a circumflex.

    ronn < test.md > test.1

    The circumflex is discarded. test.md contains:

    test - render a circumflex

    DESCRIPTION

    We are trying to render a circumflex.

    y = 2^x

    opened by ldenneau 2
Turn your ES5 code into readable ES6. Lebab does the opposite of what Babel does.

Lebab Lebab transpiles your ES5 code to ES6/ES7. It does exactly the opposite of what Babel does. If you want to understand what Lebab exactly does, t

Lebab 5.5k Dec 31, 2022
🦕 An opposite function of nullish coalescing operator

unnullish unnullish returns undefined if value is nullish, otherwise it executes callback and returns the result. It is an opposite function of the nu

Alisue 15 Dec 15, 2022