Any way to disable smart fractions?

Is there any Hugo configuration option to turn off Blackfriday’s smart fractions conversion? If not, is there any way to stop the conversion on an item by item basis? For example, I don’t want 1/2/3 to be rendered as a fraction, but I can’t find any way to stop it.

In the Blackfriday API yes (as to turning it off) . in the Hugo API - no.

I started on some work exposing some of those (or one) flags here:

To add support for angled quotes - but I’m waiting for a merge in BF before I can finish.

Maybe I can be persued to split the config part of it into its own PR :—)

Not a solution, but related:

If that one gets pulled in it is easy to add more “knobs” for Blackfriday.

I know @spf13 isn’t a big fan of too many configration options – but I guess there are areas where there are no default that fits all. But then there is the question about “where to stop.”

I think this should be an map of values in the config file rather than a bunch of individual settings. I’m adding better support to viper to enable this to happen easily.

There’s a pull request in the works that solves this:

And now you can turn them off/on on site and page level:

Pull Request #142 for Blackfriday:

has been made to prevent strings like 1/2/3, 1/4/2005 or 2005/3/4 from turning into ½/3, ¼/2005 or 2005/¾, as even setting fractions = false under [blackfriday] won’t help these special cases either.

Hopefully, with this little change made to Blackfriday, no users would see the need to turn off Blackfriday’s smart fractions conversion any more. After all, this “SmartyPants Fractions” is a rather nifty feature actually. :slight_smile:

1 Like

Woohoo! Vytautas Šaltenis (@rtfb) has kindly merged the Pull Request into in Blackfriday!

@Matthew_Reed, please do a go get -v -u (make sure you have that -u flag) and give it a try! :slight_smile:

1 Like