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

Formatters discussion #2102

Open
eksperimental opened this issue Mar 28, 2025 · 1 comment
Open

Formatters discussion #2102

eksperimental opened this issue Mar 28, 2025 · 1 comment

Comments

@eksperimental
Copy link
Contributor

I'm opening up this issue to discuss about the formatters

Currently ExDoc support two formats, HTML and Epub. Recently we are introducing Markdown in two separate PRs.
#1992
#1976

The first PR came from the need to generate Erlang manpages #1962

The second one came from need to feed the AI Coding tools https://elixirforum.com/t/generate-docs-markdown-similar-to-epub/67946

What I see is that with this new Markdown formatters we are duplicating the logic three times (one per format) and formatted markdowns may look good if you visualize them with a markdown reader, but they may skip information needed for the OTP manpages. It felt a bit contrived while doing the PR.

I think we should generate an agnostic format (that could very well be JSON) and then build the HTML, EPub, Markdown and whatever format is needed in the future.
This way the logic will be in one place.

Reading the thread about LLMs https://elixirforum.com/t/generate-docs-markdown-similar-to-epub/67946
We may do away with the JSON format without the need to create a Markdown version of it.

A plugin system for the formatters may be needed and these could be implemented as a separate Elixir package (it could be as simple as a module that implements a formatter behaviour).

Opinions?

/cc @zuiderkwast, @garazdawi, @mayel, @josevalim, @mjrusso

@josevalim
Copy link
Member

Yes, our goal is to simplify the formatter contract to make it easier to implement the new one. My goal is to implement the Markdown format and then refactor all common and uncommon logic. But to me, we need to implement them first, then extract it out. It is something we want to do (and a blocker for merging this) but I have had low priority to focus on it.

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

2 participants