Skip to content

Consider using markdown.extensions.nl2br #183

Open
@robscott

Description

One of the common frustrations with mkdocs-material is how new lines are handled. Some examples:

Will not be rendered as a list:

Paragraph text
* List
* Item

Will be rendered as a list:

Paragraph text

* List
* Item

This is a particular pain point in #129 where we're adding generated API reference docs using https://github.com/elastic/crd-ref-docs that are running into this problem. This has also been a recurring pain point in Gateway API documentation, with far too many lists missing the correct line breaks and therefore not being rendered correctly.

If we were to enable the markdown.extensions.nl2br extension, the above problems would go away, but in their place we'd get a different one. It's common to add line breaks in markdown to break up paragraphs for simpler code review and editing, for example, wrapping at 80 chars. If we do this, it creates a strange effect:

Before extension:
Screenshot 2025-01-09 at 9 29 56 PM

After extension:
Screenshot 2025-01-09 at 9 29 46 PM

Markdown source:

Gateway API Inference Extension is an official Kubernetes project focused on
extending [Gateway API](https://gateway-api.sigs.k8s.io/) with inference
specific routing extensions.

The overall resource model focuses on 2 new inference-focused
[personas](/concepts/roles-and-personas) and corresponding resources that
they are expected to manage:

Metadata

Assignees

No one assigned

    Labels

    kind/documentationCategorizes issue or PR as related to documentation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions