Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output man pages #1962

Open
zuiderkwast opened this issue Nov 13, 2024 · 8 comments
Open

Output man pages #1962

zuiderkwast opened this issue Nov 13, 2024 · 8 comments

Comments

@zuiderkwast
Copy link

When OTP switched to using ex_doc in OTP 27, we lost the man pages for the OTP modules.

Would you accept a PR to produce man pages, or is there a way to access the intermediate markdown format and use an external tool (e.g. pandoc) to generate man pages from it?

Example of an OTP man page from OTP 26:

image

@josevalim
Copy link
Member

It probably makes the most sense for us to have a markdown output. Then you can use something like pandoc to convert it to man. :) PRs exploring this would be welcome!

@eksperimental
Copy link
Contributor

eksperimental commented Nov 24, 2024

I remember some years ago I proposed having a Markdown formatter. I think having the documentation in this format opens up the possibility to a lot of things.

Now that I have some free time I can look into working on an implementation. What would the basic requirements be?

@josevalim
Copy link
Member

I can't think of many requirements, actually. I guess the only question is if it is one markdown file per module or one per function. If it is one per module, then it is equivalent to our other formatters, but probably considerably simpler.

@zuiderkwast
Copy link
Author

One per module matches the old OTP man pages, so for this use case, it's perfect.

@eksperimental
Copy link
Contributor

I would go with one file per module per file. This way the documentation could be readable over a terminal with less or markdown reader.

@garazdawi
Copy link
Contributor

We have an escript that converts a subset of markdown to man pages: https://github.com/erlang/otp/blob/master/make/markdown_to_man.escript. So if ex_doc could generate markdown documents for each module, that escript could be used to create man pages for it.

Note that the escript is on intended for general use, only of the subset of markdown used by the Erlang/OTP docs.

@eksperimental
Copy link
Contributor

eksperimental commented Nov 27, 2024

I'm already working on it, and I have a draft working version. I will create soon an issue so we can discuss about anything related to this feature.

@eksperimental
Copy link
Contributor

eksperimental commented Dec 31, 2024

Here's the PR #1992 with the Markdown implementation.

You can see the generated markdown files in this repo https://github.com/eksperimental/ex_doc_markdown_formatter_docs and tell me if that would suit your needs for generating the man pages or if there is something that needs to be changed/added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants