I have the following Markdown content file (the actual text was pasted from a new tweet window to confirm it is 280 characters):
+++
publishDate = 2020-06-05T14:08:12Z
title = "280 Char Lipsum"
+++
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras convallis sodales interdum. Aenean placerat arcu et varius fermentum. Duis vitae tincidunt nunc. Aenean auctor laoreet sem, ac blandit purus finibus ut. Maecenas auctor, leo in suscipit imperdiet, nibh quam ullamcorper
Then I have this testing snippet in a template:
{{- if eq .Section "microposts" -}}
<p>RuneCount: {{ strings.RuneCount .Content }}</p>
<p>plainify RuneCount: {{ (plainify .Content) | strings.RuneCount }}</p>
<p>countrunes: {{ countrunes .Content }}</p>
{{- end -}}
That yields this rendered content:
- RuneCount: 288
- plainify RuneCount: 281
- countrunes: 241
The plainify
variant seems to get me closer to 280, I just wondered if there is anything I can do to get the count completely correct every time?
Is .Content
the wrong thing to be operating on with the functions?