Why do my single and double quotes look different when I write in markdown?

Hello,
I’ve noticed that my single and double quotes are rendered differently when I’m writing content in markdown. In Org format, both the apostrophes and double quotes looked fine, but after switching to markdown, they appear slightly tilted, almost like they’re in italics, even though I haven’t changed any font settings like size or type.

HTML output from Org syntax. It looks ok:

HTML output from Markdown:

I’m wondering if there’s a setting that could make these characters appear straight rather than tilted.

https://gohugo.io/getting-started/configuration-markup/#typographer

You can either disable the typographer extension, or change the replacement character for single and double quotes.

This:

[markup.goldmark.extensions.typographer]
disable = true

Or this:

[markup.goldmark.extensions.typographer]
apostrophe = "'"
leftDoubleQuote = '"'
leftSingleQuote = "'"
rightDoubleQuote = '"'
rightSingleQuote = "'"
1 Like

The output from org mode looks like an apostrophe to me, not like a single quote.

Thank you. Is there any reason the typographer is enabled by default, or is it just set that way based on preference?

The default was set many years ago, presumably because more people wanted it enabled than disabled. Not sure.

I added it this way. I think I did it correctly, but I’m not sure.

hugo.toml:

[markup]
  [markup.goldmark]
    [markup.goldmark.extensions]
      [markup.goldmark.extensions.typographer]
        disable = true

  [markup.highlight]
    noClasses = false

The first part is correct.

With this bit…

[markup.highlight]
noClasses = false

… you will need to generate a style sheet (using the hugo gen chromastyles command). If set to true (the default), syntax highlighted code blocks will use inline style attributes.

I have the stylesheet generated. In that case I can leave it as is, right?

Yes, you can.

Sorry for posting this here. I have one last question, and I don’t want to open a new thread for it, even though that would have been more appropriate. I’ve noticed that some front matters use YAML syntax while others use TOML. Is this just a matter of preference? Can I use either one I want for posts? For example, I prefer the YAML format for all posts, but I left hugo.toml in TOML. However, I think the two can work together until I eventually switch the Hugo configuration to YAML at some point.

Yes, it is.

1 Like

Mostly…dates are strings with yaml but date values with toml

@irkode brings up the most important factor.

TOML has a date data type; YAML and JSON do not. The data type is irrelevant for the four predefined front matter date fields (date, publishDate, expiryDate, lastmod)… Hugo casts those fields to time.Time values.

But for custom date fields (under the params key), quoted date values are strings. But with TOML, if you omit the quotes, it is unmarshaled to a date/time value. That makes date comparisons easier, in particular when using a where clause.

Front matter example:

+++
title = 'Post 1'
date = 2024-10-26T12:23:13-07:00
draft = false
[params]
eventDate = 2024-10-31T16:30:00-07:00
+++

More details:
https://gohugo.io/functions/collections/where/#date-comparison

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.