arobase-che / remark-attr

Remark plugin to add support for custom attributes
Other
58 stars 16 forks source link

Stop looking for attrs in the fenced code #14

Open Hypercubed opened 4 years ago

Hypercubed commented 4 years ago

Happy new year!

Do you while we can get rid of this code: https://github.com/arobase-che/remark-attr/blob/master/src/index.js#L194

If we still need it we might need to improve the algorithm here. I've found several cases where the attrs are being picked up when they shouldn't... for example:

```html
code {info=string}
This is an awesome code
```

will apply the info="string" attribute to the outer code block.

My workaround, for now, is to add attr markup to prevent remark-attr from diving into the value:

```html {}
code {info=string}
This is an awesome code
```
Hypercubed commented 4 years ago

Looking again at this code was the intent to do parsedAttr = parseAttr(eaten.lang, eaten.lang.indexOf(' ')); instead of looking invalue?

Hypercubed commented 4 years ago

@arobase-che I can submit a PR if we are ready to remove this legacy code... or maybe put it behind a flag?

arobase-che commented 4 years ago

Sorry I didn't take time to understand the problem.

PR are welcome.

You are talking about deleting the legacy code of tokenizeFencedCode ?

https://github.com/arobase-che/remark-attr/blob/ca607cdc1034cac9ce96bb042ae5e97bd7b79027/src/index.js#L259-L263