I’m trying to convert some of my HTML content to ReStructuredText. The problem is that I have a lot of custom HTML, so much that I’d abandon conversion if I had to write a special parser for each thing.
By default:
text = '''
Heading
=======
<p class="jQuery-addThis">Test</p>
'''
docutils.core.publish_parts(text, writer_name='html')['html_body']
Escapes the <, >, and " with <, > and ".
How do I tell publish_parts (or another function) to NOT convert the HTML?
Additional information:
I need this functionality for the following reasons:
- AddThis
- Google Analytics
- Discus
- Facebook Plugins
- Twitter Plugins
I’ve been told to switch to Markdown, but I’d rather use ReStructuredText. Is this possible?
Thanks in advance!
Edit: I should’ve included “without the raw directive” in the subject line. I’m guessing that this is impossible, but if anyone knows of a way around it, I’d be very great full.
You need to use the
rawdata pass-through directive. Your example would become:You can also look into using pandoc to automatically convert the HTML to restructuredText.