Skip to content

Escape square brackets even less? #529

@nicolamori

Description

@nicolamori

Context

Square brackets escape has been relaxed in #112 and in #464. However, for my use case (Gitlab flavored markdown) it still falls short because it screws the automatic generation of the ToC which is done by inserting the [[_TOC_]] token. Currently it gets formatted as \[\[_TOC_\]\] and this breaks the ToC generation on Gitlab.

Proposal

Either:

  1. implementing Support for "ignore" comments #53
  2. adding an additional heuristics ignoring double brackets for escape_square_brackets in src/mdformat/renderer/_util.py

could work. Proposal 1 would probably be the best since it would solve other issues and have no side effects, but being open since a long time I guess it might be hard to implement. Proposal 2 could be easier, but I'm not sure if it would work nor which side effects it could have.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions