prettier / prettier/prettier

Markdown/YAML: Don't avoid escaping single quotes?

Open
#7,467 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

lang:yaml status:needs discussion
Dominant language
JavaScript
Stars
52.3k
Forks
5k
Avg merge
19h 2m
Merged PRs (30d)
117

Description

Prettier 1.19.1
Playground link

# Options (if any):
--single-quote

Input:

title: 'Don''t replace me!'

Output:

title: "Don't replace me!"

Expected behavior:

Related to #973 which has been closed for almost 2 years, but arguably 'Don''t replace me!' is much more readable than 'Don\'t replace me!' which was the primary argument against it there.

My current use case is a Gatsby blog with mixed script generated and non-generated Markdown.
I'd rather not disable Prettier on all my Markdown posts just because of these errors on select generated content.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Markdown example with the --single-quote option using the linked Prettier Playground, then trace the Markdown/YAML formatting entry point responsible for quote escaping. Done means the input remains valid and is formatted with the requested single-quote style without changing the doubled apostrophe to double quotes; add coverage for the shown input and output.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, markdown, yaml
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.