zope.structuredtext
raw JSON → 6.0 verified Mon Apr 27 auth: no python maintenance
zope.structuredtext provides a parser for StructuredText, a lightweight markup language. Version 6.0 requires Python >=3.9. The package is in maintenance mode with infrequent releases.
pip install zope.structuredtext Common errors
error AttributeError: module 'zope.structuredtext' has no attribute 'StructuredText2Html' ↓
cause The old function name was removed in v5.0.
fix
Use 'from zope.structuredtext import structuredtext2html'.
error ValueError: Unrecognized directive: '.. code:: python' ↓
cause StructuredText does not support reStructuredText directives like '.. code::'.
fix
Use StructuredText markup only. For code blocks, indent or use [[code]].
Warnings
breaking In version 6.0, the 'html' method no longer accepts parameters like 'level'. Use the newer API or wrap calls. ↓
fix Call wiki.html() without arguments, or parse with options before generation.
deprecated The function 'StructuredText2Html' was removed in v5.0; use 'structuredtext2html' instead. ↓
fix Replace with 'from zope.structuredtext import structuredtext2html'.
gotcha The parser is case-sensitive for markup. For example, '_italic_' works, but '_Italic_' fails if not matching. ↓
fix Ensure markup is lowercase where required. Refer to StructuredText spec.
Imports
- StructuredText
from zope.structuredtext import StructuredText - html2structuredtext
from zope.structuredtext import html2structuredtext - structuredtext2html wrong
from zope.structuredtext import StructuredText2Htmlcorrectfrom zope.structuredtext import structuredtext2html
Quickstart
from zope.structuredtext import StructuredText
wiki = StructuredText('''
Title
-----
This is a paragraph with _italic_, *bold*, and a [[link]].
* Bullet 1
* Bullet 2
''')
print(wiki.html())