getpelican / pelican

Static site generator that supports Markdown and reST syntax. Powered by Python.

Home Page:https://getpelican.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ampersands don't seem to be escaped in text in markdown

mikekreuzer opened this issue · comments

  • I have read the Filing Issues and subsequent “How to Get Help” sections of the documentation.
  • I have searched the issues (including closed ones) and believe that this is not a duplicate.
  • OS version and name: macOS 14.3
  • Python version: 3.12
  • Pelican version: 4.9.1
  • Link to theme: Simple, & custom ones
  • Links to plugins: just the markdown extension

Issue

Python-Markdown gives me:

import markdown
md = markdown.Markdown()
md.convert('this & that')            # gives <p>this &amp; that</p>

But on a pelican page the same markdown gives me:

<p>this & that</p>

Unescaped

I can't reproduce this. On my workstation, I get the following in my generated output:

<p>this <span class="amp">&amp;</span> that</p>

I can't reproduce this. On my workstation, I get the following in my generated output:

<p>this <span class="amp">&amp;</span> that</p>

Do you have typogrify installed/active? (I think that's where the <span> comes from...)

Do you have typogrify installed/active? (I think that's where the <span> comes from...)

<span> yes from typogrify, but escaped &amp; is not. So I cannot replicate this either, here is without typogrify:

$ cat content/articles/article.md
title: test
date: 01-01-2023

this & that
$ cat pelicanconf.py
SITEURL = 'https://example.com'
TIMEZONE = 'Europe/Paris'

TYPOGRIFY = False
$ pelican content -s pelicanconf.py
Done: Processed 1 article, 0 drafts, 0 hidden articles, 0 pages, 0 hidden pages and 0 draft pages in 0.09 seconds.
$ grep that output/test.html
        <meta name="description" content="this & that" />
</footer><!-- /.post-info -->      <p>this &amp; that</p>

I am an idiot - profuse apologies.

PyCharm & Safari were both unescaping the text again when they showed it to me, even in the editor, I don't know why they'd do that, it was only when I happened to open a file in VS Code that I saw it was indeed there all along.

Sorry, sorry, sorry.

Please let us laugh with you ;) Glad you figured it out!