blackfriday icon indicating copy to clipboard operation
blackfriday copied to clipboard

Optional support to ignore code in tex fences

Open j2kun opened this issue 5 years ago • 2 comments

Cf. https://github.com/gohugoio/hugo/issues/5431 for context.

In brief, I'd like to contribute a feature whereby one can configure blackfriday to ignore code between latex fences (specified by the user, and disabled by default). The central issue is that the renderer will insert emphasis in the middle of tex formulas, such as $x_1^2 + x_2^2$, interfering with the later tex rendering (e.g., mathjax).

The standard tex equation fences are $$ for inline, and \[ \] or $$ $$ for multiline. I would be happy to have hard-coded fixes for these (and only these) equation fences, but I imagine the maintainer of this project would prefer something less hacky. So I propose allowing the user to instead specify any set of open/close fences to skip when processing.

Multiline would be implemented similarly to the div check here 1, and the paragraph content would be passed through unchanged. Inline would be presumably implemented here 2 (not entirely sure).

I'm happy to add this feature, but might need a bit of hinting so as to not waste a reviewer's time, especially for the preferred method of configuring which fences to ignore.

j2kun avatar Nov 18 '18 03:11 j2kun

I'm not sure who the correct maintainer is: perhaps @rtfb based on recent commits? Have you had a chance to think about this proposal? I would, of course, add the feature to your standards.

j2kun avatar Dec 30 '18 23:12 j2kun

I agree this would be a useful feature. However, now that Hugo is using the Goldmark processor do we still want to keep this open?

ghbrown avatar Jun 07 '23 02:06 ghbrown