How to prevent a text character from being transformed?

Is there a way to write in markdown (c) without it being transformed into © or 2013/14 without it being transformed into 201314?

Thanks :slight_smile:

There are different ways to handle it, depending on where it is.

If in your content (like a page or blog post), then you might wrap it in a shortcode or use backticks like you did to get (c) to show up in these forums.

If it is in your footer, and therefore part of a partial or other part of the payout, that portion of text is probably being passed through markdownify, in which case you change that to what you want. :slight_smile:

1 Like

To disable this, you can disable the whole smartypants feature of Blackfriday, either for a post (via front-matter) or for the whole site (in the site config). See Blackfriday options.

Disabling the whole smartypants feature, will disable this too. Looks like that’s what you want to do, as you cannot selectively disable the (c) conversion.

But if you want to selectively disable just this fractions conversion feature, you can disable the fractions feature from the same Blackfriday options.

Add this to your front-matter (TOML version):

[blackfriday]
  smartypants = false

or

[blackfriday]
  fractions = false
2 Likes

Both of the above solutions worked for me and are good for different situations.

Thank you both for your help :smile:

Hugo will parse (c) to ©, and (r) to ®. But some times, it is not what I want.

If it is in the text, I can use \(c\) to disable it. But in some cases, it is not working well.

For example, when using MathJax:

$$
AveP = \int_0^1 p(r) dr
$$

There will be a ® in the equation, which makes me crazy!

crazy-equation

You may want to look at this discussion:

As @martignoni pointed, the only way to prevent this right now is to disable smartypants completely.

This is a bug in Blackfriday; it shouldn’t try be be smart in equation and latex blocks. There’s even a PR submitted to Blackfriday that removes the need to do the extra backslash escaping, and as a side product fixes this issue you pointed too.

See:

It might help if you and everyone else interested in better Blackfriday+LaTeX support is vocal in that PR thread.

It works. Thank you!

[blackfriday]
  smartypants = false