Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-markdown2 for openSUSE:Factory checked in at 2022-09-30 17:57:47 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-markdown2 (Old) and /work/SRC/openSUSE:Factory/.python-markdown2.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-markdown2" Fri Sep 30 17:57:47 2022 rev:10 rq:1007065 version:2.4.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-markdown2/python-markdown2.changes 2022-03-26 22:32:29.666070984 +0100 +++ /work/SRC/openSUSE:Factory/.python-markdown2.new.2275/python-markdown2.changes 2022-09-30 17:58:06.157288137 +0200 @@ -1,0 +2,44 @@ +Thu Sep 29 15:51:26 UTC 2022 - Yogalakshmi Arunachalam <yarunacha...@suse.com> + +- python-markdown2 2.4.5 + [pull #466] Add optional dependencies to setup.py +- python-markdown2 2.4.4 + [pull #439] Fix TypeError if html-classes extra is None + [pull #441] Remove Python2 support + [pull #445] Replace <strike> with <s> in strike extra + [pull #446] Fix link patterns extra applying within links + [pull #443] create proper entry point + [pull #449] Codespans inside link text issue344 + [pull #451] Underline and HTML comments + [pull #453] Links with brackets + [pull #454] Fix emacs local variable one-liners + [pull #457] Example of the current mixed-paragraph mode behavior in lists + [pull #455] Fix code block indentation in lists + [pull #434] Fix filter bypass leading to XSS (#362) + [pull #464] Fix html-classes extra not applying to code spans + [pull #462] Fix pygments block matching + [pull #462] Fix pyshell blocks in blockquotes + [pull #463] Fix multilevel lists + [pull #468] Remove _uniform_outdent_limit function + [pull #470] Add support for ordered lists that don't start at 1. (#469) + [pull #472] Fix AssertionError with lazy numbered lists (issue #471) + [pull #475] Add <ul> and <ol> tags to html-classes extra (#352) + [pull #473] XSS test and fix +- python-markdown2 2.4.3 + [pull #413] Fix meta indentation + [pull #414] Fix code surrounded by blank lines inside blockquote fenced code blocks + [pull #417] Fix inline code pipe symbol within tables (issue #399) + [pull #418] Fix code block parsing error (issue #327) + [pull #419] Fix hr block created when not supposed to (issue #400) + [pull #421] Fix backslashes removed by adjacent code blocks (issues #369 and #412) + [pull #420] Fix md5-* in resulting HTML when several code blocks follow one by one (issue #355) + [pull #422] Fix excessive <br> tags in lists using break-on-newline extra (issue #394) + [pull #424] Standardize key and value definitions for metadata extra (issue #423) + [pull #427] Fix fenced code blocks breaking lists (issue #426) + [pull #429] Fix catastrophic backtracking (Regex DoS) in pyshell blocks. + [pull #431] Fix incorrect indentation of fenced code blocks within lists + [pull #436] RST admonitions + [pull #430] Improve error message if link_patterns forgotten + [pull #437] fix compatibility with pygments 2.12 + +------------------------------------------------------------------- Old: ---- markdown2-2.4.2.tar.gz New: ---- markdown2-2.4.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-markdown2.spec ++++++ --- /var/tmp/diff_new_pack.oPBE18/_old 2022-09-30 17:58:06.605289095 +0200 +++ /var/tmp/diff_new_pack.oPBE18/_new 2022-09-30 17:58:06.609289104 +0200 @@ -18,7 +18,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-markdown2 -Version: 2.4.2 +Version: 2.4.3 Release: 0 Summary: A Python implementation of Markdown License: MIT ++++++ markdown2-2.4.2.tar.gz -> markdown2-2.4.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/CHANGES.md new/markdown2-2.4.3/CHANGES.md --- old/markdown2-2.4.2/CHANGES.md 2021-12-02 04:50:38.000000000 +0100 +++ new/markdown2-2.4.3/CHANGES.md 2022-04-28 01:21:58.000000000 +0200 @@ -1,5 +1,24 @@ # python-markdown2 Changelog +## python-markdown2 2.4.3 + +- [pull #413] Fix meta indentation +- [pull #414] Fix code surrounded by blank lines inside blockquote fenced code blocks +- [pull #417] Fix inline code pipe symbol within tables (issue #399) +- [pull #418] Fix code block parsing error (issue #327) +- [pull #419] Fix hr block created when not supposed to (issue #400) +- [pull #421] Fix backslashes removed by adjacent code blocks (issues #369 and #412) +- [pull #420] Fix md5-* in resulting HTML when several code blocks follow one by one (issue #355) +- [pull #422] Fix excessive <br> tags in lists using break-on-newline extra (issue #394) +- [pull #424] Standardize key and value definitions for metadata extra (issue #423) +- [pull #427] Fix fenced code blocks breaking lists (issue #426) +- [pull #429] Fix catastrophic backtracking (Regex DoS) in pyshell blocks. +- [pull #431] Fix incorrect indentation of fenced code blocks within lists +- [pull #436] RST admonitions +- [pull #430] Improve error message if link_patterns forgotten +- [pull #437] fix compatibility with pygments 2.12 + + ## python-markdown2 2.4.2 - [pull #408] Fix for fenced code blocks issue #396 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/CONTRIBUTORS.txt new/markdown2-2.4.3/CONTRIBUTORS.txt --- old/markdown2-2.4.2/CONTRIBUTORS.txt 2021-12-02 04:45:53.000000000 +0100 +++ new/markdown2-2.4.3/CONTRIBUTORS.txt 2022-03-14 02:21:58.000000000 +0100 @@ -50,3 +50,5 @@ Denis Kasak (github.com/dkasak) Maximilian Hils (github.com/mhils) BarkeH (github.com/BarkeH) +cav71 (github.com/cav71) +Crozzers (github.com/Crozzers) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/PKG-INFO new/markdown2-2.4.3/PKG-INFO --- old/markdown2-2.4.2/PKG-INFO 2021-12-02 04:50:50.984773400 +0100 +++ new/markdown2-2.4.3/PKG-INFO 2022-04-28 01:22:04.044128400 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: markdown2 -Version: 2.4.2 +Version: 2.4.3 Summary: A fast and complete Python implementation of Markdown Home-page: https://github.com/trentm/python-markdown2 Author: Trent Mick diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/README.md new/markdown2-2.4.3/README.md --- old/markdown2-2.4.2/README.md 2021-12-02 04:45:53.000000000 +0100 +++ new/markdown2-2.4.3/README.md 2022-04-08 21:19:05.000000000 +0200 @@ -13,7 +13,7 @@ Markdown.pl. Markdown2 also comes with a number of extensions (called "extras") for things like syntax coloring, tables, header-ids. See the "Extra Syntax" section below. "markdown2" supports all Python versions -2.6+ or 3.3+ (and pypy and jython, though I don't frequently test those). +3.5+ (and pypy and jython, though I don't frequently test those). There is another [Python markdown.py](https://python-markdown.github.io/). However, at @@ -48,14 +48,14 @@ ```python >>> import markdown2 >>> markdown2.markdown("*boo!*") # or use `html = markdown_path(PATH)` -u'<p><em>boo!</em></p>\n' +'<p><em>boo!</em></p>\n' >>> from markdown2 import Markdown >>> markdowner = Markdown() >>> markdowner.convert("*boo!*") -u'<p><em>boo!</em></p>\n' +'<p><em>boo!</em></p>\n' >>> markdowner.convert("**boom!**") -u'<p><strong>boom!</strong></p>\n' +'<p><strong>boom!</strong></p>\n' ``` As a script (CLI): ```shell @@ -88,7 +88,7 @@ ```shell >>> import markdown2 >>> markdown2.markdown("*boo!*", extras=["footnotes"]) -u'<p><em>boo!</em></p>\n' +'<p><em>boo!</em></p>\n' ``` There are a number of currently implemented extras for tables, footnotes, syntax coloring of `<pre>`-blocks, auto-linking patterns, table of contents, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/lib/markdown2.egg-info/PKG-INFO new/markdown2-2.4.3/lib/markdown2.egg-info/PKG-INFO --- old/markdown2-2.4.2/lib/markdown2.egg-info/PKG-INFO 2021-12-02 04:50:50.000000000 +0100 +++ new/markdown2-2.4.3/lib/markdown2.egg-info/PKG-INFO 2022-04-28 01:22:03.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: markdown2 -Version: 2.4.2 +Version: 2.4.3 Summary: A fast and complete Python implementation of Markdown Home-page: https://github.com/trentm/python-markdown2 Author: Trent Mick diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/lib/markdown2.egg-info/SOURCES.txt new/markdown2-2.4.3/lib/markdown2.egg-info/SOURCES.txt --- old/markdown2-2.4.2/lib/markdown2.egg-info/SOURCES.txt 2021-12-02 04:50:50.000000000 +0100 +++ new/markdown2-2.4.3/lib/markdown2.egg-info/SOURCES.txt 2022-04-28 01:22:03.000000000 +0200 @@ -21,6 +21,13 @@ test/tm-cases/CVE-2018-5773.html test/tm-cases/CVE-2018-5773.opts test/tm-cases/CVE-2018-5773.text +test/tm-cases/admonitions.html +test/tm-cases/admonitions.opts +test/tm-cases/admonitions.text +test/tm-cases/admonitions_with_fenced_code_blocks.html +test/tm-cases/admonitions_with_fenced_code_blocks.opts +test/tm-cases/admonitions_with_fenced_code_blocks.tags +test/tm-cases/admonitions_with_fenced_code_blocks.text test/tm-cases/ampersands.html test/tm-cases/ampersands.tags test/tm-cases/ampersands.text @@ -33,6 +40,8 @@ test/tm-cases/auto_link_safe_mode.opts test/tm-cases/auto_link_safe_mode.tags test/tm-cases/auto_link_safe_mode.text +test/tm-cases/backslash_removed_by_adjacent_backtick.html +test/tm-cases/backslash_removed_by_adjacent_backtick.text test/tm-cases/basic_safe_mode.html test/tm-cases/basic_safe_mode.opts test/tm-cases/basic_safe_mode.tags @@ -52,6 +61,9 @@ test/tm-cases/break_on_newline.html test/tm-cases/break_on_newline.opts test/tm-cases/break_on_newline.text +test/tm-cases/break_on_newline_excessive_br_tags_in_ul.html +test/tm-cases/break_on_newline_excessive_br_tags_in_ul.opts +test/tm-cases/break_on_newline_excessive_br_tags_in_ul.text test/tm-cases/code_block_with_tabs.html test/tm-cases/code_block_with_tabs.tags test/tm-cases/code_block_with_tabs.text @@ -111,9 +123,21 @@ test/tm-cases/fenced_code_blocks_issue161.opts test/tm-cases/fenced_code_blocks_issue161.tags test/tm-cases/fenced_code_blocks_issue161.text +test/tm-cases/fenced_code_blocks_issue327.html +test/tm-cases/fenced_code_blocks_issue327.opts +test/tm-cases/fenced_code_blocks_issue327.tags +test/tm-cases/fenced_code_blocks_issue327.text +test/tm-cases/fenced_code_blocks_issue355.html +test/tm-cases/fenced_code_blocks_issue355.opts +test/tm-cases/fenced_code_blocks_issue355.tags +test/tm-cases/fenced_code_blocks_issue355.text test/tm-cases/fenced_code_blocks_issue396.html test/tm-cases/fenced_code_blocks_issue396.opts test/tm-cases/fenced_code_blocks_issue396.text +test/tm-cases/fenced_code_blocks_issue426.html +test/tm-cases/fenced_code_blocks_issue426.opts +test/tm-cases/fenced_code_blocks_issue426.tags +test/tm-cases/fenced_code_blocks_issue426.text test/tm-cases/fenced_code_blocks_issue86.html test/tm-cases/fenced_code_blocks_issue86.opts test/tm-cases/fenced_code_blocks_issue86.tags @@ -209,6 +233,8 @@ test/tm-cases/hr_length.text test/tm-cases/hr_spaces.html test/tm-cases/hr_spaces.text +test/tm-cases/hr_uniform_characters.html +test/tm-cases/hr_uniform_characters.text test/tm-cases/html5_block_tags.html test/tm-cases/html5_block_tags.tags test/tm-cases/html5_block_tags.text @@ -221,6 +247,10 @@ test/tm-cases/incorrect_list_parse.html test/tm-cases/incorrect_list_parse.tags test/tm-cases/incorrect_list_parse.text +test/tm-cases/inline_code_pipe_within_table.html +test/tm-cases/inline_code_pipe_within_table.opts +test/tm-cases/inline_code_pipe_within_table.tags +test/tm-cases/inline_code_pipe_within_table.text test/tm-cases/inline_links.html test/tm-cases/inline_links.text test/tm-cases/issue21_gt_escaping.html @@ -305,6 +335,9 @@ test/tm-cases/metadata2.opts test/tm-cases/metadata2.tags test/tm-cases/metadata2.text +test/tm-cases/metadata3.html +test/tm-cases/metadata3.opts +test/tm-cases/metadata3.text test/tm-cases/mismatched_footnotes.html test/tm-cases/mismatched_footnotes.opts test/tm-cases/mismatched_footnotes.text @@ -335,6 +368,10 @@ test/tm-cases/pyshell_and_fenced_code_blocks.opts test/tm-cases/pyshell_and_fenced_code_blocks.tags test/tm-cases/pyshell_and_fenced_code_blocks.text +test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.html +test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.opts +test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.tags +test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.text test/tm-cases/raw_html.html test/tm-cases/raw_html.text test/tm-cases/ref_links.html diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/lib/markdown2.py new/markdown2-2.4.3/lib/markdown2.py --- old/markdown2-2.4.2/lib/markdown2.py 2021-12-02 04:45:53.000000000 +0100 +++ new/markdown2-2.4.3/lib/markdown2.py 2022-04-28 01:14:34.000000000 +0200 @@ -40,6 +40,7 @@ Supported extra syntax options (see -x|--extras option below and see <https://github.com/trentm/python-markdown2/wiki/Extras> for details): +* admonitions: Enable parsing of RST admonitions. * break-on-newline: Replace single new line characters with <br> when True * code-friendly: Disable _ and __ for em and strong. * cuddled-lists: Allow lists to be cuddled to the preceding paragraph. @@ -97,7 +98,7 @@ # not yet sure if there implications with this. Compare 'pydoc sre' # and 'perldoc perlre'. -__version_info__ = (2, 4, 2) +__version_info__ = (2, 4, 3) __version__ = '.'.join(map(str, __version_info__)) __author__ = "Trent Mick" @@ -248,6 +249,12 @@ self._toc_depth = self.extras["toc"].get("depth", 6) self._instance_extras = self.extras.copy() + if 'link-patterns' in self.extras: + if link_patterns is None: + # if you have specified that the link-patterns extra SHOULD + # be used (via self.extras) but you haven't provided anything + # via the link_patterns argument then an error is raised + raise MarkdownError("If the 'link-patterns' extra is used, an argument for 'link_patterns' is required") self.link_patterns = link_patterns self.footnote_title = footnote_title self.footnote_return_symbol = footnote_return_symbol @@ -256,6 +263,7 @@ self.cli = cli self._escape_table = g_escape_table.copy() + self._code_table = {} if "smarty-pants" in self.extras: self._escape_table['"'] = _hash_text('"') self._escape_table["'"] = _hash_text("'") @@ -361,6 +369,9 @@ if "fenced-code-blocks" in self.extras and self.safe_mode: text = self._do_fenced_code_blocks(text) + if 'admonitions' in self.extras: + text = self._do_admonitions(text) + # Because numbering references aren't links (yet?) then we can do everything associated with counters # before we get started if "numbering" in self.extras: @@ -443,14 +454,20 @@ # another-var: blah blah # # # header - _meta_data_pattern = re.compile(r'^(?:---[\ \t]*\n)?((?:[\S\w]+\s*:(?:\n+[ \t]+.*)+)|(?:.*:\s+>\n\s+[\S\s]+?)(?=\n\w+\s*:\s*\w+\n|\Z)|(?:\s*[\S\w]+\s*:(?! >)[ \t]*.*\n?))(?:---[\ \t]*\n)?', re.MULTILINE) - _key_val_pat = re.compile(r"[\S\w]+\s*:(?! >)[ \t]*.*\n?", re.MULTILINE) - # this allows key: > - # value - # conutiues over multiple lines - _key_val_block_pat = re.compile( - r"(.*:\s+>\n\s+[\S\s]+?)(?=\n\w+\s*:\s*\w+\n|\Z)", re.MULTILINE + _meta_data_pattern = re.compile(r''' + ^(?:---[\ \t]*\n)?( # optional opening fence + (?: + [\S \t]*\w[\S \t]*\s*:(?:\n+[ \t]+.*)+ # indented lists + )|(?: + (?:[\S \t]*\w[\S \t]*\s*:\s+>(?:\n\s+.*)+?) # multiline long descriptions + (?=\n[\S \t]*\w[\S \t]*\s*:\s*.*\n|\s*\Z) # match up until the start of the next key:value definition or the end of the input text + )|(?: + [\S \t]*\w[\S \t]*\s*:(?! >).*\n? # simple key:value pair, leading spaces allowed + ) + )(?:---[\ \t]*\n)? # optional closing fence + ''', re.MULTILINE | re.VERBOSE ) + _key_val_list_pat = re.compile( r"^-(?:[ \t]*([^\n]*)(?:[ \t]*[:-][ \t]*(\S+))?)(?:\n((?:[ \t]+[^\n]+\n?)+))?", re.MULTILINE, @@ -516,7 +533,7 @@ # Multiline value if v[:3] == " >\n": - self.metadata[k.strip()] = v[3:].strip() + self.metadata[k.strip()] = _dedent(v[3:]).strip() # Empty value elif v == "\n": @@ -986,12 +1003,15 @@ re.X | re.M) return footnote_def_re.sub(self._extract_footnote_def_sub, text) - _hr_re = re.compile(r'^[ ]{0,3}([-_*][ ]{0,2}){3,}$', re.M) + _hr_re = re.compile(r'^[ ]{0,3}([-_*])[ ]{0,2}(\1[ ]{0,2}){2,}$', re.M) def _run_block_gamut(self, text): # These are all the transformations that form block-level # tags like paragraphs, headers, and list items. + if 'admonitions' in self.extras: + text = self._do_admonitions(text) + if "fenced-code-blocks" in self.extras: text = self._do_fenced_code_blocks(text) @@ -1049,8 +1069,8 @@ less_than_tab = self.tab_width - 1 _pyshell_block_re = re.compile(r""" - ^([ ]{0,%d})>>>[ ].*\n # first line - ^(\1.*\S+.*\n)* # any number of subsequent lines + ^([ ]{0,%d})>>>[ ].*\n # first line + ^(\1[^\S\n]*\S.*\n)* # any number of subsequent lines with at least one character ^\n # ends with a blank line """ % less_than_tab, re.M | re.X) @@ -1059,7 +1079,7 @@ def _table_sub(self, match): trim_space_re = '^[ \t\n]+|[ \t\n]+$' trim_bar_re = r'^\||\|$' - split_bar_re = r'^\||(?<!\\)\|' + split_bar_re = r'^\||(?<![\`\\])\|' escape_bar_re = r'\\\|' head, underline, body = match.groups() @@ -1219,7 +1239,7 @@ # Do hard breaks: if "break-on-newline" in self.extras: - text = re.sub(r" *\n", "<br%s\n" % self.empty_element_suffix, text) + text = re.sub(r" *\n(?!\<(?:\/?(ul|ol|li))\>)", "<br%s\n" % self.empty_element_suffix, text) else: text = re.sub(r" {2,}\n", " <br%s\n" % self.empty_element_suffix, text) @@ -1833,9 +1853,14 @@ yield tup yield 0, "</code>" - def wrap(self, source, outfile): + def wrap(self, source, outfile=None): """Return the source with a code, pre, and div.""" - return self._wrap_div(self._wrap_pre(self._wrap_code(source))) + if outfile is None: + # pygments >= 2.12 + return self._wrap_pre(self._wrap_code(source)) + else: + # pygments < 2.12 + return self._wrap_div(self._wrap_pre(self._wrap_code(source))) formatter_opts.setdefault("cssclass", "codehilite") formatter = HtmlCodeFormatter(**formatter_opts) @@ -1844,10 +1869,10 @@ def _code_block_sub(self, match, is_fenced_code_block=False): lexer_name = None if is_fenced_code_block: - lexer_name = match.group(1) + lexer_name = match.group(2) if lexer_name: formatter_opts = self.extras['fenced-code-blocks'] or {} - codeblock = match.group(2) + codeblock = match.group(3) codeblock = codeblock[:-1] # drop one trailing newline else: codeblock = match.group(1) @@ -1878,10 +1903,15 @@ return codeblock lexer = self._get_pygments_lexer(lexer_name) if lexer: + # remove leading indent from code block + leading_indent, codeblock = self._uniform_outdent(codeblock) + codeblock = unhash_code( codeblock ) colored = self._color_with_pygments(codeblock, lexer, **formatter_opts) - return "\n\n%s\n\n" % colored + + # add back the indent to all lines + return "\n%s\n" % self._uniform_indent(colored, leading_indent, True) codeblock = self._encode_code(codeblock) pre_class_str = self._html_class_str_from_tag("pre") @@ -1891,7 +1921,7 @@ else: code_class_str = self._html_class_str_from_tag("code") - return "\n\n<pre%s><code%s>%s\n</code></pre>\n\n" % ( + return "\n<pre%s><code%s>%s\n</code></pre>\n" % ( pre_class_str, code_class_str, codeblock) def _html_class_str_from_tag(self, tag): @@ -1922,16 +1952,16 @@ ((?=^[ ]{0,%d}\S)|\Z) # Lookahead for non-space at line-start, or end of doc # Lookahead to make sure this block isn't already in a code block. # Needed when syntax highlighting is being used. - (?![^<]*\</code\>) + (?!([^<]|<(/?)span)*\</code\>) ''' % (self.tab_width, self.tab_width), re.M | re.X) return code_block_re.sub(self._code_block_sub, text) _fenced_code_block_re = re.compile(r''' - (?:\n+|\A\n?) - ^```\s{0,99}?([\w+-]+)?\s{0,99}?\n # opening fence, $1 = optional lang - (.*?) # $2 = code block content - ^```[ \t]*\n # closing fence + (?:\n+|\A\n?|(?<=\n)) + (^[ \t]*`{3,})\s{0,99}?([\w+-]+)?\s{0,99}?\n # $1 = opening fence (captured for back-referencing), $2 = optional lang + (.*?) # $3 = code block content + \1[ \t]*\n # closing fence ''', re.M | re.X | re.S) def _fenced_code_block_sub(self, match): @@ -2005,9 +2035,47 @@ for before, after in replacements: text = text.replace(before, after) hashed = _hash_text(text) - self._escape_table[text] = hashed + self._code_table[text] = hashed return hashed + _admonitions = r'admonition|attention|caution|danger|error|hint|important|note|tip|warning' + _admonitions_re = re.compile(r''' + ^(\ *)\.\.\ (%s)::\ * # $1 leading indent, $2 the admonition + (.*)? # $3 admonition title + ((?:\s*\n\1\ {3,}.*)+?) # $4 admonition body (required) + (?=\s*(?:\Z|\n{4,}|\n\1?\ {0,2}\S)) # until EOF, 3 blank lines or something less indented + ''' % _admonitions, + re.IGNORECASE | re.MULTILINE | re.VERBOSE + ) + + def _do_admonitions_sub(self, match): + lead_indent, admonition_name, title, body = match.groups() + + admonition_type = '<strong>%s</strong>' % admonition_name + + # figure out the class names to assign the block + if admonition_name.lower() == 'admonition': + admonition_class = 'admonition' + else: + admonition_class = 'admonition %s' % admonition_name.lower() + + # titles are generally optional + if title: + title = '<em>%s</em>' % title + + # process the admonition body like regular markdown + body = self._run_block_gamut("\n%s\n" % self._uniform_outdent(body)[1]) + + # indent the body before placing inside the aside block + admonition = self._uniform_indent('%s\n%s\n\n%s\n' % (admonition_type, title, body), self.tab, False) + # wrap it in an aside + admonition = '<aside class="%s">\n%s</aside>' % (admonition_class, admonition) + # now indent the whole admonition back to where it started + return self._uniform_indent(admonition, lead_indent, False) + + def _do_admonitions(self, text): + return self._admonitions_re.sub(self._do_admonitions_sub, text) + _strike_re = re.compile(r"~~(?=\S)(.+?)(?<=\S)~~", re.S) def _do_strike(self, text): text = self._strike_re.sub(r"<strike>\1</strike>", text) @@ -2335,7 +2403,7 @@ def _unescape_special_chars(self, text): # Swap back in all the special characters we've hidden. - for ch, hash in list(self._escape_table.items()): + for ch, hash in list(self._escape_table.items()) + list(self._code_table.items()): text = text.replace(hash, ch) return text @@ -2343,6 +2411,26 @@ # Remove one level of line-leading tabs or spaces return self._outdent_re.sub('', text) + def _uniform_outdent(self, text): + # Removes the smallest common leading indentation from each line + # of `text` and returns said indent along with the outdented text. + + # Find leading indentation of each line + ws = re.findall(r'(^[ \t]*)(?:[^ \t\n])', text, re.MULTILINE) + # Get smallest common leading indent + ws = sorted(ws)[0] + # Dedent every line by smallest common indent + return ws, ''.join( + (line.replace(ws, '', 1) if line.startswith(ws) else line) + for line in text.splitlines(True) + ) + + def _uniform_indent(self, text, indent, include_empty_lines=False): + return ''.join( + (indent + line if line.strip() or include_empty_lines else '') + for line in text.splitlines(True) + ) + class MarkdownWithExtras(Markdown): """A markdowner class that enables most extras: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/testall.py new/markdown2-2.4.3/test/testall.py --- old/markdown2-2.4.2/test/testall.py 2021-12-02 04:45:53.000000000 +0100 +++ new/markdown2-2.4.3/test/testall.py 2022-04-08 21:19:05.000000000 +0200 @@ -26,7 +26,8 @@ def _gen_python_names(): yield "python" - for ver in [(2,6), (2,7), (3,3), (3,4), (3,5), (3,6), (3,7)]: + # generate version numbers from python 3.5 to 3.20 + for ver in [(3, i) for i in range(5, 20)]: yield "python%d.%d" % ver if sys.platform == "win32": yield "python%d%d" % ver @@ -43,8 +44,8 @@ def testall(): for ver, python in _gen_pythons(): - if ver < (2,6) or ver in ((3,0), (3,1), (3,2)): - # Don't support Python < 2.6, 3.0/3.1/3.2. + if ver < (3, 5): + # Don't support Python < 3.5 continue ver_str = "%s.%s" % ver print("-- test with Python %s (%s)" % (ver_str, python)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/admonitions.html new/markdown2-2.4.3/test/tm-cases/admonitions.html --- old/markdown2-2.4.2/test/tm-cases/admonitions.html 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/admonitions.html 2022-04-20 06:01:34.000000000 +0200 @@ -0,0 +1,53 @@ +<aside class="admonition note"> + <strong>NOTE</strong> + <em>Admonitions</em> + <p>They contain 3 main parts, the admonition type, title and body. </p> + <p>The admonition type is case insensitive, title is optional and the body + should be able to contain pretty much anything. For example:</p> + <ul> + <li>Lists</li> + <li>With multiple levels + <ul> + <li>Of indentation</li> + </ul></li> + </ul> + <p>And code blocks:</p> + <pre><code>print('indented code blocks') + </code></pre> +</aside> + +<aside class="admonition warning"> + <strong>warning</strong> + <p>The admonition's body must be indented by a tab or 3 or more spaces + from where the admonition was declared</p> +</aside> + +<p>Otherwise the text is no longer part of the admonition.</p> + +<aside class="admonition important"> + <strong>IMPORTANT</strong> + <p>You can also use 3 or more empty lines after an admonition <br /> + to end it</p> +</aside> + +<pre><code>print('In case you wanted something like') +print('an indented code block right after') +</code></pre> + +<aside class="admonition"> + <strong>admonition</strong> + <em>Generic admonitions</em> + <p>These should be given a title but this is not enforced</p> + <aside class="admonition note"> + <strong>note</strong> + <em>Nested admonitions</em> + <p>Nested admonitions should also work</p> + <ul> + <li>Even inside + <aside class="admonition tip"> + <strong>tip</strong> + <p>of a list</p> + </aside></li> + </ul> + </aside> +</aside> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/admonitions.opts new/markdown2-2.4.3/test/tm-cases/admonitions.opts --- old/markdown2-2.4.2/test/tm-cases/admonitions.opts 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/admonitions.opts 2022-04-20 06:01:34.000000000 +0200 @@ -0,0 +1 @@ +{"extras": ["admonitions"]} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/admonitions.text new/markdown2-2.4.3/test/tm-cases/admonitions.text --- old/markdown2-2.4.2/test/tm-cases/admonitions.text 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/admonitions.text 2022-04-20 06:01:34.000000000 +0200 @@ -0,0 +1,38 @@ +.. NOTE:: Admonitions + They contain 3 main parts, the admonition type, title and body. + + The admonition type is case insensitive, title is optional and the body + should be able to contain pretty much anything. For example: + + - Lists + - With multiple levels + - Of indentation + + And code blocks: + + print('indented code blocks') + +.. warning:: + The admonition's body must be indented by a tab or 3 or more spaces + from where the admonition was declared + Otherwise the text is no longer part of the admonition. + +.. IMPORTANT:: + You can also use 3 or more empty lines after an admonition + to end it + + + + print('In case you wanted something like') + print('an indented code block right after') + +.. admonition:: Generic admonitions + + These should be given a title but this is not enforced + + .. note:: Nested admonitions + Nested admonitions should also work + + - Even inside + .. tip:: + of a list \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/admonitions_with_fenced_code_blocks.html new/markdown2-2.4.3/test/tm-cases/admonitions_with_fenced_code_blocks.html --- old/markdown2-2.4.2/test/tm-cases/admonitions_with_fenced_code_blocks.html 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/admonitions_with_fenced_code_blocks.html 2022-04-20 06:01:34.000000000 +0200 @@ -0,0 +1,25 @@ +<aside class="admonition note"> + <strong>note</strong> + <p>Admonitions are able to contain fenced code blocks</p> + <div class="codehilite"><pre><span></span><code><span class="nb">print</span><span class="p">(</span><span class="s1">'like so'</span><span class="p">)</span> + </code></pre></div> +</aside> + +<aside class="admonition warning"> + <strong>warning</strong> + <div class="codehilite"><pre><span></span><code><span class="nb">print</span><span class="p">(</span><span class="s1">'Consecutive blocks should also be fine'</span><span class="p">)</span> + </code></pre></div> + <div class="codehilite"><pre><span></span><code><span class="nb">print</span><span class="p">(</span><span class="s1">'Even though fenced code blocks wrap themselves in newlines'</span><span class="p">)</span> + </code></pre></div> + <aside class="admonition hint"> + <strong>hint</strong> + <em>It should also work nested</em> + <div class="codehilite"><pre><span></span><code><span class="nb">print</span><span class="p">(</span><span class="s1">'ok'</span><span class="p">)</span> + </code></pre></div> + </aside> +</aside> + +<div class="codehilite"><pre><span></span><code><span class="c1"># admonitions WITHIN fenced code blocks should NOT be rendered</span> +<span class="o">..</span> <span class="n">attention</span><span class="p">::</span> <span class="n">title</span> + <span class="n">body</span> +</code></pre></div> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/admonitions_with_fenced_code_blocks.opts new/markdown2-2.4.3/test/tm-cases/admonitions_with_fenced_code_blocks.opts --- old/markdown2-2.4.2/test/tm-cases/admonitions_with_fenced_code_blocks.opts 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/admonitions_with_fenced_code_blocks.opts 2022-04-20 06:01:34.000000000 +0200 @@ -0,0 +1 @@ +{"extras": ["admonitions", "fenced-code-blocks", "pygments"]} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/admonitions_with_fenced_code_blocks.tags new/markdown2-2.4.3/test/tm-cases/admonitions_with_fenced_code_blocks.tags --- old/markdown2-2.4.2/test/tm-cases/admonitions_with_fenced_code_blocks.tags 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/admonitions_with_fenced_code_blocks.tags 2022-04-20 06:01:34.000000000 +0200 @@ -0,0 +1 @@ +extra admonitions fenced-code-blocks pygments diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/admonitions_with_fenced_code_blocks.text new/markdown2-2.4.3/test/tm-cases/admonitions_with_fenced_code_blocks.text --- old/markdown2-2.4.2/test/tm-cases/admonitions_with_fenced_code_blocks.text 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/admonitions_with_fenced_code_blocks.text 2022-04-20 06:01:34.000000000 +0200 @@ -0,0 +1,23 @@ +.. note:: + Admonitions are able to contain fenced code blocks + ```python + print('like so') + ``` + +.. warning:: + ```python + print('Consecutive blocks should also be fine') + ``` + ```python + print('Even though fenced code blocks wrap themselves in newlines') + ``` + .. hint:: It should also work nested + ```python + print('ok') + ``` + +```python +# admonitions WITHIN fenced code blocks should NOT be rendered +.. attention:: title + body +``` \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/backslash_removed_by_adjacent_backtick.html new/markdown2-2.4.3/test/tm-cases/backslash_removed_by_adjacent_backtick.html --- old/markdown2-2.4.2/test/tm-cases/backslash_removed_by_adjacent_backtick.html 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/backslash_removed_by_adjacent_backtick.html 2022-03-22 19:33:18.000000000 +0100 @@ -0,0 +1,7 @@ +<p>hello \world</p> + +<p>hello \world my favourite letter is <code>w</code></p> + +<p>hello \world my favourite code is <code>import pickle</code></p> + +<p>hello \world my favourite letter is <code>x</code></p> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/backslash_removed_by_adjacent_backtick.text new/markdown2-2.4.3/test/tm-cases/backslash_removed_by_adjacent_backtick.text --- old/markdown2-2.4.2/test/tm-cases/backslash_removed_by_adjacent_backtick.text 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/backslash_removed_by_adjacent_backtick.text 2022-03-22 19:33:18.000000000 +0100 @@ -0,0 +1,7 @@ +hello \world + +hello \world my favourite letter is `w` + +hello \world my favourite code is `import pickle` + +hello \world my favourite letter is `x` \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/break_on_newline_excessive_br_tags_in_ul.html new/markdown2-2.4.3/test/tm-cases/break_on_newline_excessive_br_tags_in_ul.html --- old/markdown2-2.4.2/test/tm-cases/break_on_newline_excessive_br_tags_in_ul.html 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/break_on_newline_excessive_br_tags_in_ul.html 2022-03-25 03:20:28.000000000 +0100 @@ -0,0 +1,54 @@ +<h2>Conte??do</h2> + +<ul> +<li>O que ?? estrutura Co-locada (on premises), o que ?? estrutura h??brida e o que ?? estrutura em-nuvem? +<ul> +<li>Em Nuvem (cloud based)</li> +<li>Uma estrutura em-nuvem tem todos os seus principais recursos providos por um provedor de servi??os em nuvem. +<ul> +<li>Uma defini????o formal de servi??o em nuvem pode ser:</li> +<li>Entrega via internet de um servi??o de Tecnologia da Informa????o, sob demanda, em um modelo de pague-pelo-que-consome. +<ul> +<li>Brown Field ?? quando voc?? migra um servi??o existente</li> +<li>Green field ?? quando voc?? come??a do zero na nuvem, alguns tamb??m chamam isto de Cloud </li> +</ul></li> +</ul></li> +</ul></li> +</ul> + +<h2>Ordered List</h2> + +<ol> +<li>A +<ol> +<li>B +<ol> +<li>C +<ol> +<li>D</li> +<li>E</li> +</ol></li> +</ol></li> +</ol></li> +</ol> + +<h2>Mixed List</h2> + +<ol> +<li>A +<ul> +<li>B +<ol> +<li>C +<ul> +<li>D</li> +<li>E</li> +</ul></li> +<li>F +<ol> +<li>G</li> +<li>H</li> +</ol></li> +</ol></li> +</ul></li> +</ol> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/break_on_newline_excessive_br_tags_in_ul.opts new/markdown2-2.4.3/test/tm-cases/break_on_newline_excessive_br_tags_in_ul.opts --- old/markdown2-2.4.2/test/tm-cases/break_on_newline_excessive_br_tags_in_ul.opts 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/break_on_newline_excessive_br_tags_in_ul.opts 2022-03-25 03:20:28.000000000 +0100 @@ -0,0 +1 @@ +{"extras": ["break-on-newline"]} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/break_on_newline_excessive_br_tags_in_ul.text new/markdown2-2.4.3/test/tm-cases/break_on_newline_excessive_br_tags_in_ul.text --- old/markdown2-2.4.2/test/tm-cases/break_on_newline_excessive_br_tags_in_ul.text 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/break_on_newline_excessive_br_tags_in_ul.text 2022-03-25 03:20:28.000000000 +0100 @@ -0,0 +1,25 @@ +## Conte??do +- O que ?? estrutura Co-locada (on premises), o que ?? estrutura h??brida e o que ?? estrutura em-nuvem? + - Em Nuvem (cloud based) + - Uma estrutura em-nuvem tem todos os seus principais recursos providos por um provedor de servi??os em nuvem. + - Uma defini????o formal de servi??o em nuvem pode ser: + - Entrega via internet de um servi??o de Tecnologia da Informa????o, sob demanda, em um modelo de pague-pelo-que-consome. + - Brown Field ?? quando voc?? migra um servi??o existente + - Green field ?? quando voc?? come??a do zero na nuvem, alguns tamb??m chamam isto de Cloud + +## Ordered List +1. A + 1. B + 1. C + 1. D + 2. E + +## Mixed List +1. A + - B + 1. C + - D + - E + 2. F + 1. G + 2. H \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue327.html new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue327.html --- old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue327.html 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue327.html 2022-03-14 02:18:37.000000000 +0100 @@ -0,0 +1,22 @@ +<p>Inner code blocks should not render as code blocks</p> + +<pre><code>```cpp +int x = 10; +``` +</code></pre> + +<p>Without language specifier</p> + +<pre><code>``` +int x = 10; +``` +</code></pre> + +<p>Double nesting</p> + +<pre><code>```` +```cpp +int x = 10; +``` +```` +</code></pre> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue327.opts new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue327.opts --- old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue327.opts 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue327.opts 2022-03-14 02:18:37.000000000 +0100 @@ -0,0 +1 @@ +{"extras": ["fenced-code-blocks"]} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue327.tags new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue327.tags --- old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue327.tags 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue327.tags 2022-03-14 02:18:37.000000000 +0100 @@ -0,0 +1 @@ +extra fenced-code-blocks \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue327.text new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue327.text --- old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue327.text 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue327.text 2022-03-14 02:18:37.000000000 +0100 @@ -0,0 +1,23 @@ +Inner code blocks should not render as code blocks + +```` +```cpp +int x = 10; +``` +```` + +Without language specifier +```` +``` +int x = 10; +``` +```` + +Double nesting +````` +```` +```cpp +int x = 10; +``` +```` +````` \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue355.html new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue355.html --- old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue355.html 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue355.html 2022-03-22 19:33:18.000000000 +0100 @@ -0,0 +1,10 @@ +<div class="codehilite"><pre><span></span><code><span class="n">some</span> <span class="n">code</span> <span class="n">block</span> +</code></pre></div> + +<pre><code>yet another code block +</code></pre> + +<p>new line:</p> + +<pre><code>code everywhere +</code></pre> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue355.opts new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue355.opts --- old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue355.opts 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue355.opts 2022-03-22 19:33:18.000000000 +0100 @@ -0,0 +1 @@ +{"extras": ["fenced-code-blocks"]} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue355.tags new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue355.tags --- old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue355.tags 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue355.tags 2022-03-22 19:33:18.000000000 +0100 @@ -0,0 +1 @@ +extra fenced-code-blocks pygments \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue355.text new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue355.text --- old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue355.text 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue355.text 2022-03-22 19:33:18.000000000 +0100 @@ -0,0 +1,10 @@ +```python +some code block +``` +``` +yet another code block +``` +new line: +``` +code everywhere +``` \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue426.html new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue426.html --- old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue426.html 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue426.html 2022-04-10 23:59:51.000000000 +0200 @@ -0,0 +1,31 @@ +<h1>Django Templates</h1> + +<h2>NOTES</h2> + +<ul> +<li>The name should map to the URL.</li> +<li>No distro or app name prefix, they are namespaced by their dirs already</li> +<li>Since templates are made in python, the are <code>named_with_underscores.html</code> (not web style dashes).</li> +</ul> + +<h2>URL PARAMETERS IN THE TEMPLATE</h2> + +<ul> +<li>All views (except <code>generic.View</code>) from <code>django.forms.generic</code> inherit from <code>ContextMixin</code></li> +<li><p><code>ContextMixin</code> defines the method <code>get_context_data</code>:</p> + +<div class="codehilite"><pre><span></span><code><span class="k">def</span> <span class="nf">get_context_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> + <span class="n">kwargs</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="s1">'view'</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span> + <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">extra_context</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span> + <span class="n">kwargs</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">extra_context</span><span class="p">)</span> + <span class="k">return</span> <span class="n">kwargs</span> +</code></pre></div> + +<p>So when overriding one must be careful to extends <code>super</code>'s <code>kwargs</code>:</p> + +<div class="codehilite"><pre><span></span><code><span class="k">def</span> <span class="nf">get_context_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> + <span class="n">kwargs</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">get_context_data</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> + <span class="n">kwargs</span><span class="p">[</span><span class="s1">'page_title'</span><span class="p">]</span> <span class="o">=</span> <span class="s2">"Documentation"</span> + <span class="k">return</span> <span class="n">kwargs</span> +</code></pre></div></li> +</ul> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue426.opts new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue426.opts --- old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue426.opts 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue426.opts 2022-04-08 21:19:05.000000000 +0200 @@ -0,0 +1 @@ +{"extras": ["fenced-code-blocks", "pygments"]} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue426.tags new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue426.tags --- old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue426.tags 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue426.tags 2022-04-08 21:19:05.000000000 +0200 @@ -0,0 +1 @@ +extra fenced-code-blocks pygments diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue426.text new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue426.text --- old/markdown2-2.4.2/test/tm-cases/fenced_code_blocks_issue426.text 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/fenced_code_blocks_issue426.text 2022-04-08 21:19:05.000000000 +0200 @@ -0,0 +1,26 @@ +# Django Templates + +## NOTES + +- The name should map to the URL. +- No distro or app name prefix, they are namespaced by their dirs already +- Since templates are made in python, the are `named_with_underscores.html` (not web style dashes). + +## URL PARAMETERS IN THE TEMPLATE + +- All views (except `generic.View`) from `django.forms.generic` inherit from `ContextMixin` +- `ContextMixin` defines the method `get_context_data`: + ```python + def get_context_data(self, **kwargs): + kwargs.setdefault('view', self) + if self.extra_context is not None: + kwargs.update(self.extra_context) + return kwargs + ``` + So when overriding one must be careful to extends `super`'s `kwargs`: + ```py + def get_context_data(self, **kwargs): + kwargs = super().get_context_data(**kwargs) + kwargs['page_title'] = "Documentation" + return kwargs + ``` \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/hr_uniform_characters.html new/markdown2-2.4.3/test/tm-cases/hr_uniform_characters.html --- old/markdown2-2.4.2/test/tm-cases/hr_uniform_characters.html 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/hr_uniform_characters.html 2022-03-14 02:18:37.000000000 +0100 @@ -0,0 +1,48 @@ +<p>Horizontal rules should probably consist of all of the same characters +EG:</p> + +<hr /> + +<p>Or</p> + +<hr /> + +<p>Or</p> + +<hr /> + +<p>But not any of:</p> + +<p>--*</p> + +<p>-*-</p> + +<p>-**</p> + +<p>*--</p> + +<p><em>-</em></p> + +<p>**-</p> + +<p>**_</p> + +<p><em>_</em></p> + +<p>*__</p> + +<p>_**</p> + +<p><em>*</em></p> + +<p>__-</p> + +<p><em>-</em></p> + +<p>_--</p> + +<p>-__</p> + +<p>-_-</p> + +<p>--_</p> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/hr_uniform_characters.text new/markdown2-2.4.3/test/tm-cases/hr_uniform_characters.text --- old/markdown2-2.4.2/test/tm-cases/hr_uniform_characters.text 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/hr_uniform_characters.text 2022-03-14 02:18:37.000000000 +0100 @@ -0,0 +1,49 @@ +Horizontal rules should probably consist of all of the same characters +EG: + +*** + +Or + +--- + +Or + +___ + + +But not any of: + +--* + +-*- + +-** + +*-- + +*-* + +**- + +**_ + +*_* + +*__ + +_** + +_*_ + +__- + +_-_ + +_-- + +-__ + +-_- + +--_ \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/inline_code_pipe_within_table.html new/markdown2-2.4.3/test/tm-cases/inline_code_pipe_within_table.html --- old/markdown2-2.4.2/test/tm-cases/inline_code_pipe_within_table.html 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/inline_code_pipe_within_table.html 2022-03-14 02:18:37.000000000 +0100 @@ -0,0 +1,21 @@ +<table> +<thead> +<tr> + <th>Sign</th> + <th>Operator name</th> + <th>Description</th> +</tr> +</thead> +<tbody> +<tr> + <td><code>&</code></td> + <td>Bitwise and</td> + <td>Bitwise and between two integer values</td> +</tr> +<tr> + <td><code>|</code></td> + <td>Bitwise or</td> + <td>Bitwise or between two integer values</td> +</tr> +</tbody> +</table> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/inline_code_pipe_within_table.opts new/markdown2-2.4.3/test/tm-cases/inline_code_pipe_within_table.opts --- old/markdown2-2.4.2/test/tm-cases/inline_code_pipe_within_table.opts 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/inline_code_pipe_within_table.opts 2022-03-14 02:18:37.000000000 +0100 @@ -0,0 +1 @@ +{"extras": ["tables"]} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/inline_code_pipe_within_table.tags new/markdown2-2.4.3/test/tm-cases/inline_code_pipe_within_table.tags --- old/markdown2-2.4.2/test/tm-cases/inline_code_pipe_within_table.tags 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/inline_code_pipe_within_table.tags 2022-03-14 02:18:37.000000000 +0100 @@ -0,0 +1 @@ +extra tables \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/inline_code_pipe_within_table.text new/markdown2-2.4.3/test/tm-cases/inline_code_pipe_within_table.text --- old/markdown2-2.4.2/test/tm-cases/inline_code_pipe_within_table.text 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/inline_code_pipe_within_table.text 2022-03-14 02:18:37.000000000 +0100 @@ -0,0 +1,4 @@ +| Sign | Operator name | Description | +|---|---|---| +| `&` | Bitwise and | Bitwise and between two integer values | +| `|` | Bitwise or | Bitwise or between two integer values | \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/metadata.text new/markdown2-2.4.3/test/tm-cases/metadata.text --- old/markdown2-2.4.2/test/tm-cases/metadata.text 2021-12-02 04:45:53.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/metadata.text 2022-02-05 21:00:10.000000000 +0100 @@ -6,6 +6,7 @@ empty : and some: > long value + with complex indentation that goes multiline another: example alist: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/metadata2.text new/markdown2-2.4.3/test/tm-cases/metadata2.text --- old/markdown2-2.4.2/test/tm-cases/metadata2.text 2021-12-02 04:45:53.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/metadata2.text 2022-02-05 21:00:10.000000000 +0100 @@ -5,6 +5,7 @@ empty : another long: > long value + with complex indentation that goes multiline another: example diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/metadata3.html new/markdown2-2.4.3/test/tm-cases/metadata3.html --- old/markdown2-2.4.2/test/tm-cases/metadata3.html 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/metadata3.html 2022-04-08 21:19:05.000000000 +0200 @@ -0,0 +1 @@ +<p>This tests various metadata key:value configurations to make sure they will work well consecutively</p> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/metadata3.opts new/markdown2-2.4.3/test/tm-cases/metadata3.opts --- old/markdown2-2.4.2/test/tm-cases/metadata3.opts 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/metadata3.opts 2022-04-08 21:19:05.000000000 +0200 @@ -0,0 +1 @@ +{"extras": ["metadata"]} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/metadata3.text new/markdown2-2.4.3/test/tm-cases/metadata3.text --- old/markdown2-2.4.2/test/tm-cases/metadata3.text 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/metadata3.text 2022-04-08 21:19:05.000000000 +0200 @@ -0,0 +1,33 @@ +--- + : empty key should be ignored +basic: value +basic2: test consecutive basic keys +empty: +empty2 : +long-desc: > + long multiline + description + with varying levels of + indentation +long-desc2: > + test consecutive long descriptions +nested: + - list item + - following a long description +nested2: + - consecutive nested +nested3: + - + subkey: with subkeys +long-desc3: > + long description following a nested +empty-following-long-desc: +key with spaces: will also be recognized +-key_start_with_hyphen: allowed + tab indented key: allowed +finish-with : > + a nice long description + over a couple lines +--- + +This tests various metadata key:value configurations to make sure they will work well consecutively \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.html new/markdown2-2.4.3/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.html --- old/markdown2-2.4.2/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.html 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.html 2022-02-15 02:34:01.000000000 +0100 @@ -0,0 +1,13 @@ +<h3>Example:</h3> + +<blockquote> + <div class="codehilite"><pre><span></span><code><span class="k">if</span> <span class="kc">True</span><span class="p">:</span> + <span class="nb">print</span><span class="p">()</span> + + <span class="nb">print</span><span class="p">()</span> + + <span class="nb">print</span><span class="p">()</span> + + <span class="nb">print</span><span class="p">()</span> +</code></pre></div> +</blockquote> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.opts new/markdown2-2.4.3/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.opts --- old/markdown2-2.4.2/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.opts 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.opts 2022-02-15 02:34:01.000000000 +0100 @@ -0,0 +1 @@ +{"extras": ["fenced-code-blocks"]} \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.tags new/markdown2-2.4.3/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.tags --- old/markdown2-2.4.2/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.tags 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.tags 2022-02-15 02:34:01.000000000 +0100 @@ -0,0 +1 @@ +extra fenced-code-blocks pygments \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/markdown2-2.4.2/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.text new/markdown2-2.4.3/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.text --- old/markdown2-2.4.2/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.text 1970-01-01 01:00:00.000000000 +0100 +++ new/markdown2-2.4.3/test/tm-cases/quoted_fenced_code_blocks_whitespace_around_indented_lines.text 2022-02-15 02:34:01.000000000 +0100 @@ -0,0 +1,12 @@ +### Example: + +> ```python +> if True: +> print() +> +> print() +> +> print() +> +> print() +> ``` \ No newline at end of file