silvenon / remark-smartypants

remark plugin to implement SmartyPants
MIT License
54 stars 3 forks source link

curly quotes go the wrong way before a link #74

Closed sophiebits closed 9 months ago

sophiebits commented 1 year ago

If I run the following

import { remark } from 'remark'
import smartypants from 'remark-smartypants'

const result = await remark()
  .use(smartypants)
  .process('"wow". go to "[google](https://www.google.com/)" today.')

console.log(String(result))

the output is:

“wow”. go to ”[google](https://www.google.com/)” today.

Note that the curly quote before the google link goes the wrong way – it's a closing quote but should be an opening one.

silvenon commented 1 year ago

Hey, thanks for the bug report! This remark plugin is currently incredibly naive, i.e. essentially a hack, so bugs like this are going to show up. I'm out of the open source game for quite a while, unfortunately, but I would very much like this plugin to be smarter. If you'd like to take a stab at this bug I'll be around for code review!

ghost commented 11 months ago

Experiencing this bug as well. Context is something like this...

"**Bolded part** of this quote"

Where the output's left quotation mark is closing, and should be opening. Removing the ** or moving it to outside the quotation marks fixes the issue, but isn't grammatically correct since the bold is only part of the quote.

dimaMachina commented 10 months ago

@sophiebits @silvenon @gene-fls I fixed both cases with a tiny solution 🎉

2wheeh commented 9 months ago

Hi guys ! It also happens around inlineCode:

"`code` foo"

I will add some comments on #80

dimaMachina commented 9 months ago

@2wheeh ty for new case, fixed this too!

silvenon commented 9 months ago

Your bug reports and fixes rock the house, thanks to you we'll get this released in no time 💪