Closed gadamiak closed 4 years ago
The below patch makes indented fenced blocks get processed correctly:
--- plantuml_markdown.py~ 2019-08-26 13:22:37.183784233 +0200
+++ plantuml_markdown.py 2019-08-26 13:22:44.336668395 +0200
@@ -89,7 +89,7 @@
''', re.MULTILINE | re.DOTALL | re.VERBOSE)
FENCED_BLOCK_RE = re.compile(r'''
- (?P<fence>^(?:~{3,}|`{3,}))[ ]* # Opening ``` or ~~~
+ (?P<fence>^\s*(?:~{3,}|`{3,}))[ ]* # Opening ``` or ~~~
(\{?\.?(plant)?uml)[ ]* # Optional {, and lang
# args
\s*(format=(?P<quot>"|')(?P<format>\w+)(?P=quot))?
However, they still are not nested correctly, i.e. in the example the paragraph containing an image is not nested under the list item.
After some more playing around I think I found a solution for fenced blocks:
--- plantuml_markdown.py~ 2019-08-26 13:22:37.183784233 +0200
+++ plantuml_markdown.py 2019-08-26 16:08:31.235838534 +0200
@@ -89,7 +89,7 @@
''', re.MULTILINE | re.DOTALL | re.VERBOSE)
FENCED_BLOCK_RE = re.compile(r'''
- (?P<fence>^(?:~{3,}|`{3,}))[ ]* # Opening ``` or ~~~
+ (?P<fence>(?:~{3,}|`{3,}))[ ]* # Opening ``` or ~~~
(\{?\.?(plant)?uml)[ ]* # Optional {, and lang
# args
\s*(format=(?P<quot>"|')(?P<format>\w+)(?P=quot))?
@@ -101,7 +101,7 @@
[ ]*
}?[ ]*\n # Optional closing }
(?P<code>.*?)(?<=\n)
- (?P=fence)[ ]*$
+ \s*(?P=fence)[ ]*$
''', re.MULTILINE | re.DOTALL | re.VERBOSE)
def __init__(self, md):
Thanks!
I find that indented or nested blocks are not parsed. They are parsed only when starting at beginning of the line. To illustrate, this block is processed correctly
while a block nested under a list item (or whatever) is not processed
Is it possible to enable processing of nested/indented blocks?