Skip to content

Allow reflow=true to be influenced by ignore-link-urls setting #749

Description

@macintacos

Problem or motivation

To understand why I would like this, I think there needs to be some context.

I'm building a tool as a fun side project called caret (https://github.com/macintacos/caret), that basically facilitates presenting a plan from an agent in a web UI that a user can interact with and approve / request changes / reject from the web UI instead of the terminal.

To facilitate some features, I am using rumdl to essentially format the plan so that it reflows at natural line breaks, to help with telling the agent a specific place where a comment was inserted by the user. It's been working great so far.

There's a feature I want to add though - I basically want to update the plan presentation such that it "hides" links (but still allows them to be clickable). This basically entails hiding the [ and ] characters, and everything in side of the ().

However, if I do that, sometimes the plans that get generated just look weird, simply because I'm hiding the excess text, but that text still "exists", so rumdl needs to format it.

At first, I thought that ignore-link-urls would solve the issue, but it appears that it's only respected as a lint option, not a fmt option.

Take the following markdown:

This is a piece of [text](https://google.com/lol/alskjdhflkajshdfljkahsdfljkhasdkjfhasdkjfhasdjklfhlkajsdhfkjlashdflkjashdflkjahdskfjlhasdjfha) that should be on a single line

Running rumdl with ignore-link-urls=true and reflow=true still formats the line:

$ rumdl fmt \
      --config 'MD013.reflow=true' \
      --config 'MD013.ignore-link-urls=true' \
      .tmp/rumdl-test.md
.tmp/rumdl-test.md:1:1: [MD013] Paragraph could be normalized to use line length of 90 characters [fixed]

Fixed: Fixed 1/1 issues in 1 file (8ms)
This is a piece of
[text](https://google.com/lol/alskjdhflkajshdfljkahsdfljkhasdkjfhasdkjfhasdjklfhlkajsdhfkjlashdflkjashdflkjahdskfjlhasdjfha)
that should be on a single line

Proposed solution

It would be incredible for my use case if ignore-link-urls (or some other option) allowed me to reformat text as if the text within the parentheses and the brackets weren't there at all. Then, I think my plan view would look exactly the way I would want visually, without needing to come up with a hack on top of rumdl itself to reformat the plans nicely.

Alternatives considered

No response

Feature category

Auto-fix / formatting

Example markdown

Contribution

  • I would be willing to submit a PR to implement this feature

Additional context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions