From: Waylan L. <way...@ic...> - 2016-09-01 22:58:22
|
Andrew, Sorry for the delayed response. I just found your email in a backlog of messages in my inbox. When you stash something, a placeholder gets inserted into the document. That placeholder will then get wrapped in `<p>` tags by the Markdown parser, which results in the behavior you have encountered. To compensate for this, when swapping out the placeholder for the stash in a postprocessor, we check if the placeholder is in a paragraph all by itself, and if the stash starts with a block level HTML element, we replace the placeholder and the wrapping `p` tag. However, if the `p` tag contains more that only a placeholder, or the stashed item does not start with a block level HTML tag, we simple replace the placeholder inside the paragraph, leaving the `p` tags in place (which is how inline raw HTML is handled). You can see the code at https://github.com/waylan/Python-Markdown/blob/master/markdown/postprocessors.py#L64. `section` tags are considered block level, so if you are not seeing that behavior, then make sure that there is no whitespace surrounding your tags (in the stash) and that no whitespace or anything else is included with your placeholder on a line by itself. Your placeholder should have a blank line both before and after. Waylan Limberg On 08/24/2016 12:32 PM, Slaughter, Andrew E wrote: > I am attempting to stash an opening and closing html tag "<section>" > and "</section>" in certain parts of my markdown in a Preprocessor, > which is working. However, it seems to wrap the injected html within a > "<p>" block. Is there a way to avoid this? > > Thanks, > Andrew > > > ------------------------------------------------------------------------------ > > > _______________________________________________ > Python-markdown-discuss mailing list > Pyt...@li... > https://lists.sourceforge.net/lists/listinfo/python-markdown-discuss |