Skip to content

Feature request: Links: preserve both text and link #105

Description

@ivan-sennov-takeda

Feature request

Add ability to preserve both link's text and url, like: [Link](https://website.com) -> Link (https://website.com).

Description

Now there is the only option to chose between keeping text or url from md links (replaceLinksWithURL).

Sometimes it needs to preserve both text and url from links, which especially useful in hidden fields for screen readers, crawlers, accessibility functionality and AI agents.

For those places, keeping only URL may look odd:
Please visit our [schedule](http://website/link) for... -> Please visit our http://website/link for...
and doesn't make sense.
I would like to have an option to keep both parts and put the link between parentheses (discussable).

Proposal

  • Add an option (e.g. preserveLinksUrl: boolean), which enables described behavior;
  • When the option is enabled, MD links are rendered in the following way:
    [Link text](http://website.com) -> Link text (http://website.com);
  • No older features are affected to ensure backward compatibility.

Optional

  • Add callback option to have an ability to redefine rendering for specific md parts: headers, lists, list items, links, etc.
    • callback function should accept type of entity and entity itself as arguments
    • the function should return string as the desired rendering result

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions