Nikola, Markdown and Emojis
My Nikola installation does not like markdown posts that contain Unicode literals. I think this behavior started when I migrated from an Intel Mac to an Apple Silicon Mac.
I'm referring in particular to emoji literals like these:
When I include any of these in a post, the post body renders as the string literal h t m l >
:
Update 2022/11/25
This appears to be an issue with lxml. I'm not yet sure whether it is specific to Apple Silicon, or to macOS.
[original text deleted]
Workaround
The lxml github repository has had several commits since the 1 July release of lxml 4.9.1. One of these, entitled "Work around libxml2 bug in affected versions that failed to reset the namespace count in the parser context.", may be the one that has solved the emoji problem.
In any case the following steps enable Nikola 8.2.3 on macOS to render pages that contain emoji literals.
Notes:
- These should be run with whichever Python environment/virtual environment contains your Nikola 8.2.3 installation.
- At time of writing, lxml is at head revision
eddd78d320b97a9170704009d871db337ece8069
, from 12 Nov 2022.
python -m pip uninstall lxml python -m pip install cython mkdir lxml_from_github cd lxml_from_github git clone https://github.com/lxml/lxml.git cd lxml STATIC_DEPS=true python -m pip install . # If you want to clean up: cd ../.. rm -rf lxml_from_github
Proof that Nikola is happy again: 😀