Skip to content
This repository has been archived by the owner on Nov 3, 2019. It is now read-only.

Extra backslash sometimes inserted when using $ in text #405

Closed
lourd opened this issue Jun 18, 2019 · 3 comments
Closed

Extra backslash sometimes inserted when using $ in text #405

lourd opened this issue Jun 18, 2019 · 3 comments
Labels
bug Something isn't working bug-upstream A bug in an upstream project that affects gatsby-mdx

Comments

@lourd
Copy link

lourd commented Jun 18, 2019

I noticed that on some parts of my portfolio site (made with gatsby and gatsby-mdx), there are extra backslashes being inserted in some places where dollar signs are used. For example:

  • Go to https://descioli.design/grove and Find for \$ — there are 6 occurrences on the page. There are 12 usages of $, though — not every $ is preceded by a backslash.
  • The MDX source for that page is here. Note: no backslashes.
  • The rendering of the page is here. Pretty standard AFAIK.

It only started happening when I switched from Remark to MDX. I didn't notice it when I did the initial switch.

Environment

  • macOS and ubuntu, latest version
  • @mdx-js/mdx@1.0.20, gatsby-mdx@0.6.3
  • node@10.1.0, yarn@1.13.0

Steps to reproduce

Clone my portfolio repo, https://github.com/lourd/descioli-design, and run it. No additional configuration needed.

Expected behaviour

No extra backslashes.

Actual behaviour

Extra backslashes


This is a duplicate of mdx-js/mdx#606. I wasn't sure if it should be filed there or here.

@johno johno added the bug Something isn't working label Jun 18, 2019
@johno
Copy link
Collaborator

johno commented Jun 18, 2019

Hmm, it looks like the source MDX itself contains "$" which is why it's ending up in the rendered page AFAICT.

@johno johno added the bug-upstream A bug in an upstream project that affects gatsby-mdx label Jun 19, 2019
@lourd
Copy link
Author

lourd commented Jun 21, 2019

The issue isn't the dollar signs showing up, it's the mysterious extra backslashes before the dollar sign. The backslashes aren't present in the source. They are present in the rendered version.

@lourd
Copy link
Author

lourd commented Jun 21, 2019

Your comment made me go and re-inspect the source just to make sure I wasn't missing something obvious... and I was 🤦‍♂

The \$ was only visible when looking at the raw version of the source. And I hadn't bothered to look at it in my editor, just on GitHub.

The slashes were automatically inserted Prettier. I'd set it up to run on pre-commit and missed the fact that it was also formatting .mdx files. Sorry to waste your time.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working bug-upstream A bug in an upstream project that affects gatsby-mdx
Projects
None yet
Development

No branches or pull requests

2 participants