Manpage renderer #208

Open
opened 2026-01-29 14:30:27 +00:00 by claunia · 9 comments
Owner

Originally created by @ghost on GitHub (Jun 1, 2018).

Based on: https://github.com/dotnet/docfx/issues/2648#issuecomment-393918553

@xoofx, do you know of a good spec of manpage that would work on BSD, OSX, Linux and Solaris?
Pandoc's man writer is d32e866449/src/Text/Pandoc/Writers/Man.hs. We probably need some specs to validate output.

Originally created by @ghost on GitHub (Jun 1, 2018). Based on: https://github.com/dotnet/docfx/issues/2648#issuecomment-393918553 @xoofx, do you know of a good spec of manpage that would work on BSD, OSX, Linux and Solaris? Pandoc's man writer is https://github.com/jgm/pandoc/blob/d32e8664498d799932927d9865ce71e014472ef3/src/Text/Pandoc/Writers/Man.hs. We probably need some specs to validate output.
claunia added the enhancementPR Welcome! labels 2026-01-29 14:30:28 +00:00
Author
Owner

@ghost commented on GitHub (Jun 5, 2018):

@omajid, do you know of any place where we can find spec suite for manpages that would work across the board of Unix-like operating systems?

For example, i don't get the difference between

https://linux.die.net/man/1/man and
https://linux.die.net/man/7/man

and apparently NET-2 BSD uses mdoc compatible macros, which doesn't work on Linux without providing -mdoc switch to man(7). In order to validate the implementation, it would be great to have some markdown and corresponding manpage.

@ghost commented on GitHub (Jun 5, 2018): @omajid, do you know of any place where we can find spec suite for manpages that would work across the board of Unix-like operating systems? For example, i don't get the difference between https://linux.die.net/man/1/man and https://linux.die.net/man/7/man and apparently NET-2 BSD uses mdoc compatible macros, which doesn't work on Linux without providing `-mdoc` switch to man(7). In order to validate the implementation, it would be great to have some markdown and corresponding manpage.
Author
Owner

@omajid commented on GitHub (Jun 5, 2018):

do you know of any place where we can find spec suite for manpages that would work across the board of Unix-like operating systems?

Sorry, not off the top of my head. I will look into it.

https://linux.die.net/man/1/man
https://linux.die.net/man/7/man

As I understand it, man(1) is about the man command and how to use it. man(7) is about how to write those man pages - their syntax and other implementation details.

apparently NET-2 BSD uses mdoc compatible macros, which doesn't work on Linux

Does the other way around work? If we use the non-mdoc macros, do docs render correctly on NetBSD and other BSDs?

@omajid commented on GitHub (Jun 5, 2018): > do you know of any place where we can find spec suite for manpages that would work across the board of Unix-like operating systems? Sorry, not off the top of my head. I will look into it. > https://linux.die.net/man/1/man > https://linux.die.net/man/7/man As I understand it, `man(1)` is about the `man` command and how to use it. `man(7)` is about how to write those man pages - their syntax and other implementation details. > apparently NET-2 BSD uses mdoc compatible macros, which doesn't work on Linux Does the other way around work? If we use the non-mdoc macros, do docs render correctly on NetBSD and other BSDs?
Author
Owner

@ghost commented on GitHub (Jun 6, 2018):

apparently NET-2 BSD uses mdoc compatible macros, which doesn't work on Linux

Does the other way around work? If we use the non-mdoc macros, do docs render correctly on NetBSD and other BSDs?

maybe @krytarowski or @jsonn would be able to answer it?

@ghost commented on GitHub (Jun 6, 2018): >> apparently NET-2 BSD uses mdoc compatible macros, which doesn't work on Linux > > Does the other way around work? If we use the non-mdoc macros, do docs render correctly on NetBSD and other BSDs? maybe @krytarowski or @jsonn would be able to answer it?
Author
Owner

@krytarowski commented on GitHub (Jun 6, 2018):

non-mdoc macros, what in particular?

@krytarowski commented on GitHub (Jun 6, 2018): non-mdoc macros, what in particular?
Author
Owner

@ghost commented on GitHub (Jun 6, 2018):

nothing in particular, we are just trying to figure out if there is a neutral spec for manpage document format, that would work across Linux, BSD, OSX and Solaris. Pandoc uses groff d32e866449/src/Text/Pandoc/Writers/Man.hs (L30), is this something which is considered portable in unix world?

@ghost commented on GitHub (Jun 6, 2018): nothing in particular, we are just trying to figure out if there is a neutral spec for manpage document format, that would work across Linux, BSD, OSX and Solaris. Pandoc uses groff https://github.com/jgm/pandoc/blob/d32e8664498d799932927d9865ce71e014472ef3/src/Text/Pandoc/Writers/Man.hs#L30, is this something which is considered portable in unix world?
Author
Owner

@krytarowski commented on GitHub (Jun 6, 2018):

For man pages just use mdoc.

@krytarowski commented on GitHub (Jun 6, 2018): For man pages just use mdoc.
Author
Owner

@jsonn commented on GitHub (Jun 6, 2018):

For Solaris, it depends on what exactly you mean. Newer Illumos certainly supports mdoc. Old Solaris only man. Man as macro set has many restrictions, i.e. it gives much worse results for web pages. That said, you can use mandoc to create man(7) output from mdoc as well.

@jsonn commented on GitHub (Jun 6, 2018): For Solaris, it depends on what exactly you mean. Newer Illumos certainly supports mdoc. Old Solaris only man. Man as macro set has many restrictions, i.e. it gives much worse results for web pages. That said, you can use mandoc to create man(7) output from mdoc as well.
Author
Owner

@ghost commented on GitHub (Jun 6, 2018):

Thanks! This tool (markdig) converts CommonMark markdown or HTML markup to intermediate representation, then renders the IR to CommonMark or HTML.
We want to introduce a new manpage renderer and parser from/to that IR. For this matter, we needed some well defined manpage specs and the flavor to chose from. There is a good article https://monades.roperzh.com/memories-writing-parser-man-pages/ by @roperzh, which also acknowledges the lack of formal specification as a drawback of manpage

Lack of beginner-friendly resources

Something that really confused me was the lack of a canonical, well defined and clear source to look at, there’s a lot of information in the web which assumes a lot about the reader that it takes time to grasp.

Maybe a spec can be proposed to w3/ecma etc. in effort to formalize.

@ghost commented on GitHub (Jun 6, 2018): Thanks! This tool (markdig) converts CommonMark markdown or HTML markup to intermediate representation, then renders the IR to CommonMark or HTML. We want to introduce a new manpage renderer and parser from/to that IR. For this matter, we needed some well defined manpage specs and the flavor to chose from. There is a good article https://monades.roperzh.com/memories-writing-parser-man-pages/ by @roperzh, which also acknowledges the lack of formal specification as a drawback of manpage > **Lack of beginner-friendly resources** > > Something that really confused me was the lack of a canonical, well defined and clear source to look at, there’s a lot of information in the web which assumes a lot about the reader that it takes time to grasp. Maybe a spec can be proposed to w3/ecma etc. in effort to formalize.
Author
Owner

@cjwatson commented on GitHub (Sep 13, 2019):

I'm pretty confused about why you say that mdoc macros don't work on Linux without passing -mdoc. This may have been true once, but hasn't been true for many years; they work fine without the need for a special option.

(I suspect this is moot for the purposes of this issue, but wanted to clarify it in case the idea takes root elsewhere.)

@cjwatson commented on GitHub (Sep 13, 2019): I'm pretty confused about why you say that mdoc macros don't work on Linux without passing `-mdoc`. This may have been true once, but hasn't been true for many years; they work fine without the need for a special option. (I suspect this is moot for the purposes of this issue, but wanted to clarify it in case the idea takes root elsewhere.)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#208