Skip to content

Decode typographer HTML entities in hook's .PlainText #13292

Closed
@bep

Description

@bep

This is the opposite take on #13291.

After fixing #13286 then

![A's is > B's](sunsets.jpg)

Will become PlainText=

A’s is > B’s

This will in a hook similar to Hugo's internal:

<img src="{{ $src }}" alt="{{ .PlainText }}"...

End up as

<img src="sunsets.jpg" alt="A&amp;rsquo;s is &;gt; B&amp;rsquo;s"></p>

Which is invalid.

Note that this is currently only (I think) an issue when using the typographer extension (default on) and having apostrophes in your image alt texts eg.

We really want .PlainText to be format agnostic, and the only current way I can think about fixing this, is to convert these HTML entities back to their real characters. Goldmark has an utility func for doing that.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions