question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

maintenance(docs): Switch docs formatter from Prettier to customized remark-stringify

See original GitHub issue

Description

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 with gatsby-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:closed
  • Created 3 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
tesseraliscommented, May 28, 2020

@capndave

  1. Correct, we only want to run remark-stringify on markdown files in the docs dir
  2. We’re using remark to lint the docs but prettier to format them
  3. Remark-stringify should be used in in the lint-staged command. A new format:docs command should be added that runs remark-stringify on the docs, and it should be added to the format script.
0reactions
github-actions[bot]commented, Sep 9, 2020

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! 💪💜

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found