maintenance(docs): Switch docs formatter from Prettier to customized remark-stringify
See original GitHub issueDescription
Switch the docs formatter from prettier to remark-stringify, customized with additional rules.
Motivation
remark-stringify is extensible and allows users and plugins to extend the compiler with changes. We need this flexibility to do things such as auto-generating heading IDs to docs (#20732).
Issues
The default remark-stringify won’t work for a variety of issues (even with configurations). These can be seen in this diff: https://github.com/gatsbyjs/gatsby/compare/remark-stringify?expand=1
- Doesn’t understand codeblock titles generated with
gatsby-remark-code-titles
: it escapes the underscores in the title and parses the title as part of the language block. - Adds
<>
to URLs (e.g.https://youtube.com
becomes<https://youtube.com>
). (I think) This interferes withgatsby-remark-embedder
, which requires the raw URLs to embed Youtube and Giphy links. - Doesn’t support code formatting in links (it escapes tildes)
Minor difference from Prettier:
- Doesn’t escape dollar signs (
$
) unless the latex plugin is installed. - Adds line breaks between link definitions
- Some weird table formatting?
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
(www) Autogenerate explicit IDs for headings #20732 - GitHub
Description Create a pre-commit git hook to generate custom IDs for all ... maintenance(docs): Switch docs formatter from Prettier to ...
Read more >Options - Prettier
Prettier ships with a handful of format options. To learn more about Prettier's stance on options – see the Option Philosophy. If you...
Read more >Prettier · Opinionated Code Formatter
What is Prettier? An opinionated code formatter; Supports many languages; Integrates with most editors; Has few options ...
Read more >Configuration File - Prettier
Overrides let you have different configuration for certain file extensions, folders and specific files. Prettier borrows ESLint's override format. JSON: { "semi ...
Read more >Plugins - Prettier
Plugins are ways of adding new languages or formatting rules to Prettier. Prettier's own implementations of all languages are expressed using the plugin...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@capndave
lint-staged
command. A newformat:docs
command should be added that runs remark-stringify on the docs, and it should be added to theformat
script.Hiya!
This issue has gone quiet. Spooky quiet. 👻
We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
Thanks for being a part of the Gatsby community! 💪💜