Skip to content

Re-evaluate Usage of mdformat (Enable and Disable via Comments) #103

Closed

Description

@s2t2

Currently mdformat will automatically re-format markdown used by mkdocstrings, as well as mkdocs admonitions, in a way that breaks their functionality.

Example desired mkdocstrings markdown:

::: smart_control.dataset.dataset.BuildingDataset
    options:
      members_order: source
      group_by_category: false

Example desired mkdocs admonition markdown:

!!! info "Important: Installing Pre-commit Hooks"

    To enable the pre-commit hooks, you must perform a one-time setup by running
    `pre-commit install`. This will create or update ".git/hooks/pre-commit".

Currently there is no way of disabling mdformat on a line-by-line basis. So we are currently a) ignoring the mkdocstrings related files from being formatted by mdformat, and b) not using admonitions.

See:

However if mdformat implemented comments to enable and disable specific lines, that would solve both of these issues.

Without the ability to enable and disable specific lines from being formatted, if we want to solve these issues we will have to discontinue use of mdformat in favor of another tool.

We might want to investigate a different tool for markdown formatting (revisiting #58).

Activity

  1. changed the title [-]Re-evaluate usage of `mdformat` (Enable and Disable `mdformat` via Comments)[/-] [+]Re-evaluate Usage of `mdformat` (Enable and Disable via Comments)[/+] on Jun 20, 2025
  2. pawamoy commented on Jul 11, 2025

    @pawamoy

    I'm tracking mdformat incompatibilities with mkdocs/mkdocstrings/other here: pawamoy/copier-uv#46 (comment), you might find some useful info 🙂

  3. s2t2 commented on Jul 14, 2025

    @s2t2
    CollaboratorAuthor

    We can consider trying mdformat-mkdocs, which seems like it might better handle the normal mkdocs use cases:
    https://github.com/KyleKing/mdformat-mkdocs

  4. KyleKing commented on Jul 15, 2025

    @KyleKing

    I’m the author of “mdformat-mkdocs” and would be happy to receive feedback if you run into any issues. I’ve been busier the past year, but I’m still monitoring for bug reports

    The mkdocstrings format could be supported with a plugin, but I’m not aware of one off the top of my head

  5. s2t2 commented on Aug 20, 2026

    @s2t2
    CollaboratorAuthor

    @KyleKing it looks like we will be able to use "mdformat-mkdocs" (see #176)

  6. added a commit that references this issue on Aug 21, 2026
    aa9acdd
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions