From d9c7c79da2c51c9c9250672a372699bd1f225b69 Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Wed, 10 Mar 2021 14:34:17 +0100 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=90=9B=20FIX:=20Port=20regression?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comparing to #110 I noticed a few mistaken regressions --- markdown_it/renderer.py | 1 - markdown_it/rules_inline/autolink.py | 13 ++++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/markdown_it/renderer.py b/markdown_it/renderer.py index 2dd25ecc..4452c34e 100644 --- a/markdown_it/renderer.py +++ b/markdown_it/renderer.py @@ -222,7 +222,6 @@ def fence(self, tokens: Sequence[Token], idx: int, options, env) -> str: langAttrs = "" if info: - langName = info.split()[0] arr = info.split(maxsplit=1) langName = arr[0] if len(arr) == 2: diff --git a/markdown_it/rules_inline/autolink.py b/markdown_it/rules_inline/autolink.py index f810629f..8ad2b304 100644 --- a/markdown_it/rules_inline/autolink.py +++ b/markdown_it/rules_inline/autolink.py @@ -1,7 +1,6 @@ # Process autolinks '' import re from .state_inline import StateInline -from ..common.normalize_url import normalizeLinkText, normalizeLink, validateLink EMAIL_RE = re.compile( r"^([a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$" # noqa: E501 @@ -34,8 +33,8 @@ def autolink(state: StateInline, silent: bool) -> bool: url = state.src[start + 1 : pos] if AUTOLINK_RE.search(url) is not None: - fullUrl = normalizeLink(url) - if not validateLink(fullUrl): + fullUrl = state.md.normalizeLink(url) + if not state.md.validateLink(fullUrl): return False if not silent: @@ -45,7 +44,7 @@ def autolink(state: StateInline, silent: bool) -> bool: token.info = "auto" token = state.push("text", "", 0) - token.content = normalizeLinkText(url) + token.content = state.md.normalizeLinkText(url) token = state.push("link_close", "a", -1) token.markup = "autolink" @@ -55,8 +54,8 @@ def autolink(state: StateInline, silent: bool) -> bool: return True if EMAIL_RE.search(url) is not None: - fullUrl = normalizeLink("mailto:" + url) - if not validateLink(fullUrl): + fullUrl = state.md.normalizeLink("mailto:" + url) + if not state.md.validateLink(fullUrl): return False if not silent: @@ -66,7 +65,7 @@ def autolink(state: StateInline, silent: bool) -> bool: token.info = "auto" token = state.push("text", "", 0) - token.content = normalizeLinkText(url) + token.content = state.md.normalizeLinkText(url) token = state.push("link_close", "a", -1) token.markup = "autolink" From 8d112432b5c77c3d7412d44917daf6958294ebbd Mon Sep 17 00:00:00 2001 From: Chris Sewell Date: Wed, 10 Mar 2021 14:38:20 +0100 Subject: [PATCH 2/2] update --- markdown_it/rules_inline/strikethrough.py | 2 +- tests/test_port/fixtures/tables.md | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/markdown_it/rules_inline/strikethrough.py b/markdown_it/rules_inline/strikethrough.py index d54ab133..87af4b46 100644 --- a/markdown_it/rules_inline/strikethrough.py +++ b/markdown_it/rules_inline/strikethrough.py @@ -35,7 +35,7 @@ def tokenize(state: StateInline, silent: bool): **{ "marker": marker, "length": 0, # disable "rule of 3" length checks meant for emphasis - "jump": i // 2, # for `~~` 1 marker = 2 characters, + "jump": i // 2, # for `~~` 1 marker = 2 characters "token": len(state.tokens) - 1, "end": -1, "open": scanned.can_open, diff --git a/tests/test_port/fixtures/tables.md b/tests/test_port/fixtures/tables.md index cf7a9ec9..7539ffb5 100644 --- a/tests/test_port/fixtures/tables.md +++ b/tests/test_port/fixtures/tables.md @@ -839,6 +839,7 @@ GFM 4.10 Tables (extension), Example 203 | --- | | bar |

. + GFM 4.10 Tables (extension), Example 204 . | abc | def |