Some text improperly being omitted from articles?

I noticed some lines are being deleted from the content of mds

<Much knowledge here. Lost. Found.>
<Not yet. But in time the knowledge will come. I need it all.>

Some lines in similar format do get through

<Ah.>
<How do we get in?>

What should I do to force the lines not going through to go through as plain text?

Edit:

Adding \ before < works to force lines to show up. Is that the proper thing to do in this situation?

The parser assumes that this is HTML and in the default setup HTML is stripped from your markup. Add the following parameters to your config.toml and they should turn up:

  goldmark:
    renderer:
      unsafe: true

If the code now is in the output, but invisible then your problem is, that the browser interprets it as a tag, but can’t identify what tag it is. In that case replace < with &lt; and > with &gt;. If you have access to the layout files and can add some code then have a look at htmlEscape:

The lines that get through do so, because they contain invalid markup (the dot and the question mark) so the parser sees them as normal text.

1 Like
This is <some> text. --> <p>This is text.</p>

This is \<some> text. --> p>This is <some> text.p>
1 Like

After running hugo you can grep the public directory to identify a few problems that do not generate warnings or errors during the site build:

grep --color --only-matching --recursive --ignore-case --extended-regexp "<\!-- raw HTML omitted -->|ZgotmplZ|hahahugo" public/
2 Likes

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