Interpolation in markdown tagged literal breaks formatting
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 52.3k
- Forks
- 5k
- Avg merge
- 19h 2m
- Merged PRs (30d)
- 117
Description
Prettier 3.3.3
Playground link
--parser babel
Input:
const literal = md`
1. One
3. Two
`;
const interpolated = md`
1. One
3. Two ${arg}
`;
const literalHTML = html`<p>
hello!
</p>`;
const interpolatedHTML = html`<p>
hello ${arg}!
</p>`;
Output:
const literal = md`
1. One
2. Two
`;
const interpolated = md`
1. One
3. Two ${literal}
`;
const literalHTML = html`<p>hello!</p>`;
const interpolatedHTML = html`<p>hello ${arg}!</p>`;
Expected output:
const interpolated = md`
1. One
2. Two ${arg}
`;
Markdown-in-js works as expected when it is a literal, but fails when there are interpolated values.
I tried something similar for embedded HTML, and it returns the same formatted result regardless of interpolation.
Did some digging and realize interpolated markdown was never a feature.
Will be interested to experiment with supporting it. Will likely give it a go when #13676 lands.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Prettier Playground example and compare the literal and interpolated markdown outputs. Read the discussion around supporting interpolated markdown and #13676; done means interpolated markdown preserves the intended list numbering and formatting while retaining the embedded value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, markdown
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100