Skip to content

Formatters discussion #2102

Open
Open
@eksperimental

Description

@eksperimental
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

Activity

josevalim

josevalim commented on Mar 28, 2025

@josevalim
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.

josevalim

josevalim commented on Jun 11, 2025

@josevalim
Member

I have posted important updates here: #1976 (comment)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @josevalim@eksperimental

        Issue actions

          Formatters discussion · Issue #2102 · elixir-lang/ex_doc