Skip to content

Support Accept: text/markdown for package documentation #1466

Open

Description

@Tritlo

Problem

Hackage serves documentation exclusively as HTML. For automated tools like LLMs, Claude Code, and bots, this means parsing HTML to extract the content, consuming a lot more tokens than required.

To make Haskell more useful for agents, we should implement a Markdown version of the docs. This allows agents (and humans!) to consume the docs directly, without having to parse the HTML. This is already implemented on Vercel

Proposal

Add content negotiation so that requests with Accept: text/markdown (the standard for agents) to return Markdown for key endpoints. Initially, we should focus on package descriptions and module documentation.

This will potentially involve having haddock generate markdown instead of HTML as it does currently. Before embarking on this project though, I would like some community feedback.

Activity

  1. jhrcek commented on Feb 16, 2026

    @jhrcek
    Contributor

    It's not markdown/content negotiable, but you might find it interesting that most packages have single file hoogle txt docs generated, e.g. https://hackage.haskell.org/package/aeson-2.2.3.0/docs/aeson.txt

    Not easily discoverable either, but Imo an improvement from the point of view of LLMs.

  2. Tritlo commented on Feb 16, 2026

    @Tritlo
    Author

    that's a great point. maybe v1.0 for the header could just return the .txt files (they're valid markdown as well, yes?)

  3. phadej commented on Feb 16, 2026

    @phadej
    Contributor

    Hackage serves whatever haddock generates. hackage-server assumes a bit of structure of generated documentation tarball HTML, but technically you can upload docs tarball with whatever contents you want (it's a security loophole, really).

    hackage-server doesn't really know anything about the docs. In particular, it doesn't (re)generate anything, all the (documentation) content is pregenerated by docbuilder or users. hackage-server barely serves the static content then.

  4. phadej commented on Feb 16, 2026

    @phadej
    Contributor

    As a human, I prefer well rendered HTMLs with links so I can browse around the documentation. Please no (unrendered) markdown (or whatever markup) for the humans.

  5. phadej commented on Feb 16, 2026

    @phadej
    Contributor

    This reminds me of semantic web

    The goal of the Semantic Web is to make Internet data machine-readable.

    It's fun and sad, how we given up of trying to provide information in structured data formats, and now instead rely on (imprecise) (natural) language models to extract information from "prose". Honestly, I think we have failed as technological society.

  6. Tritlo commented on Feb 16, 2026

    @Tritlo
    Author

    As a human, I prefer well rendered HTMLs with links so I can browse around the documentation. Please no (unrendered) markdown (or whatever markup) for the humans.

    I agree! That's why we'd ideally want to generate this and serve only upon request

  7. Bodigrim commented on Feb 16, 2026

    @Bodigrim
    Contributor

    As @phadej says, this is really a task for Haddock in the first place to produce Markdown documentation. Hackage (and Cabal) would be minor changes only.

  8. gbaz commented on Feb 16, 2026

    @gbaz
    Contributor

    I think teaching haddock to generate markdown is a good idea, though really what that should be part of is a move to a backend-independent intermediate layer and then "markdown" as one possible target. That said, I do not thing gen AI is a good motivation. Surely soon enough the "tokens" problem will be solved and html parsing will be done as a preliminary pass. After all, most of the internet is in HTML.

  9. Tritlo commented on Feb 16, 2026

    @Tritlo
    Author

    they'll be solved by big corp for sure, but for oss models on consumer hardware you still want to save context

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

      Issue actions