Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formatter: Support customization of link style preference #426

Open
askoufis opened this issue Jul 31, 2023 · 1 comment
Open

formatter: Support customization of link style preference #426

askoufis opened this issue Jul 31, 2023 · 1 comment

Comments

@askoufis
Copy link

Overview

Markdoc supports reference links, however the formatter chooses to format these into inline links.

Example

[A link][link]

[link]: www.example.com

is formatted as

[A link](www.example.com)

Discussion

I feel like this stylistic formatting choice should be opt-in, rather than enabled by default, if it even warrants being configurable. I'd guess that the list of people that want to configure this stylistic choice is very small, and given that prettier does not allow customization of this stylistic choice, I don't even think it should be configurable, but rather all styles of links should just be left alone.

@rpaul-stripe
Copy link
Contributor

The markdown-it library (which we use as a tokenizer) doesn't capture in the link token whether the link was written as a reference. But I don't think it would be too hard to add that to our markdown-it patch set. We would need to have it add the reference text as a meta property on the token, and then we could carry it over to the Markdoc AST and use it in the formatter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants