retext
retext copied to clipboard
Rst preview does not work with pasted code
When I paste my code the preview won't load.
code:
#####
Configure Commanger: configure all the way!
#####
*****
Configuration tutorial
*****
*****
Types:
*****
Toggle
======
Long Toggle
^^^^^^
Char
======
Long
=====
Sticky
=====
Range
=====
Sticky Range
^^^^^
Long Range
^^^^^
Hard
=====
Can you please provide some more details?
- What version of ReText do you use?
- Do you have “Use WebKit renderer” or “Use WebEngine (Chromium) renderer” checked in Edit menu?
- Do you have default markup set to reStructuredText (Edit → Default markup)?
- Does it happen just with this content or with any reStructuredText file?
- Are there any errors printed in terminal if you launch
retext
from there?
I also get an error with MD previews in files containing code blocks using ReText 8.0.0 (PyMarkups 3.1.3) in Python 3.10.7. It worked fine before in Python 3.9.2.
File "/home/paixi/.local/lib/python3.10/site-packages/ReText/mdx_posmap.py", line 114, in run
last_child = SubElement(parent, 'p')
TypeError: SubElement() argument 1 must be xml.etree.ElementTree.Element, not Element
The problem can be fixed by changing mdx_posmap.py:112 to:
last_child = xml.etree.ElementTree.SubElement(parent, 'p')
And line 19 to:
import xml
Haven't had any issues after that.
@paixi The issue that you were seeing is probably the same as one discussed in Python-Markdown/markdown#950. It happens when defusedxml module is present, and fixed in tiran/defusedxml#60.
However, the original reporter’s issue is not necessarily the same one, however as I got no reply to it, I am closing this bug.