Skip to content

Commit f0ecac6

Browse files
authored
Issue 1077 (#1094)
* #1077
1 parent e4ef5c6 commit f0ecac6

File tree

5 files changed

+184
-8
lines changed

5 files changed

+184
-8
lines changed

newdocs/src/changelog.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313

1414
### Fixed
1515

16-
- None
16+
- [Issue 1015](https://github.com/jackdewinter/pymarkdown/issues/1015)
17+
- Fixed issue with double tabs within fenced block
18+
- [Issue 1077](https://github.com/jackdewinter/pymarkdown/issues/1077)
19+
- Fixed issue with previous cleanup
1720

1821
### Changed
1922

publish/coverage.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"totalCovered": 4789
77
},
88
"lineLevel": {
9-
"totalMeasured": 19207,
10-
"totalCovered": 19207
9+
"totalMeasured": 19206,
10+
"totalCovered": 19206
1111
}
1212
}
1313

publish/test-results.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1620,7 +1620,7 @@
16201620
},
16211621
{
16221622
"name": "test.test_markdown_extra",
1623-
"totalTests": 138,
1623+
"totalTests": 143,
16241624
"failedTests": 0,
16251625
"errorTests": 0,
16261626
"skippedTests": 1,

pymarkdown/links/link_parse_helper.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def __try_to_find_link_match(
148148
new_index: int,
149149
source_text: str,
150150
text_from_blocks: str,
151-
tabified_text: str,
151+
tabified_text: Optional[str],
152152
) -> Tuple[str, bool, int, str, str, Optional[str]]:
153153
POGGER.debug("collapsed reference?")
154154

@@ -962,9 +962,6 @@ def look_for_link_formats(
962962
elif ParserHelper.is_character_at_index(
963963
source_text, new_index, LinkParseHelper.__link_format_reference_start
964964
):
965-
assert (
966-
tabified_text is not None
967-
), "If we have a link start character, must have tabified text."
968965
(
969966
lhp.label_type,
970967
tried_full_reference_form,

test/test_markdown_extra.py

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5747,6 +5747,182 @@ def test_extra_042d():
57475747
act_and_assert(source_markdown, expected_gfm, expected_tokens)
57485748

57495749

5750+
@pytest.mark.gfm
5751+
def test_extra_042x():
5752+
"""
5753+
TBD
5754+
"""
5755+
5756+
# Arrange
5757+
source_markdown = """# test
5758+
5759+
## Example: [foo][bar]
5760+
5761+
[foo]: https://example.com
5762+
"""
5763+
expected_tokens = [
5764+
"[atx(1,1):1:0:]",
5765+
"[text(1,3):test: ]",
5766+
"[end-atx::]",
5767+
"[BLANK(2,1):]",
5768+
"[atx(3,1):2:0:]",
5769+
"[text(3,4):Example: : ]",
5770+
"[text(3,13):[:]",
5771+
"[text(3,14):foo:]",
5772+
"[text(3,17):]:]",
5773+
"[text(3,18):[:]",
5774+
"[text(3,19):bar:]",
5775+
"[text(3,22):]:]",
5776+
"[end-atx::]",
5777+
"[BLANK(4,1):]",
5778+
"[link-ref-def(5,1):True::foo:: :https://example.com:::::]",
5779+
"[BLANK(6,1):]",
5780+
]
5781+
expected_gfm = """<h1>test</h1>
5782+
<h2>Example: [foo][bar]</h2>"""
5783+
5784+
# Act & Assert
5785+
act_and_assert(source_markdown, expected_gfm, expected_tokens)
5786+
5787+
5788+
@pytest.mark.gfm
5789+
def test_extra_042xx():
5790+
"""
5791+
TBD
5792+
"""
5793+
5794+
# Arrange
5795+
source_markdown = """# test
5796+
5797+
## Example: [foo][bar]
5798+
5799+
[bar]: https://example.com
5800+
"""
5801+
expected_tokens = [
5802+
"[atx(1,1):1:0:]",
5803+
"[text(1,3):test: ]",
5804+
"[end-atx::]",
5805+
"[BLANK(2,1):]",
5806+
"[atx(3,1):2:0:]",
5807+
"[text(3,4):Example: : ]",
5808+
"[link(3,13):full:https://example.com::::bar:foo:False::::]",
5809+
"[text(3,14):foo:]",
5810+
"[end-link::]",
5811+
"[end-atx::]",
5812+
"[BLANK(4,1):]",
5813+
"[link-ref-def(5,1):True::bar:: :https://example.com:::::]",
5814+
"[BLANK(6,1):]",
5815+
]
5816+
expected_gfm = """<h1>test</h1>
5817+
<h2>Example: <a href="https://example.com">foo</a></h2>"""
5818+
5819+
# Act & Assert
5820+
act_and_assert(source_markdown, expected_gfm, expected_tokens)
5821+
5822+
5823+
@pytest.mark.gfm
5824+
def test_extra_042xa():
5825+
"""
5826+
TBD
5827+
"""
5828+
5829+
# Arrange
5830+
source_markdown = """# test
5831+
5832+
## Example: [foo](https://example.com)
5833+
5834+
"""
5835+
expected_tokens = [
5836+
"[atx(1,1):1:0:]",
5837+
"[text(1,3):test: ]",
5838+
"[end-atx::]",
5839+
"[BLANK(2,1):]",
5840+
"[atx(3,1):2:0:]",
5841+
"[text(3,4):Example: : ]",
5842+
"[link(3,13):inline:https://example.com:::::foo:False::::]",
5843+
"[text(3,14):foo:]",
5844+
"[end-link::]",
5845+
"[end-atx::]",
5846+
"[BLANK(4,1):]",
5847+
"[BLANK(5,1):]",
5848+
]
5849+
expected_gfm = """<h1>test</h1>
5850+
<h2>Example: <a href="https://example.com">foo</a></h2>"""
5851+
5852+
# Act & Assert
5853+
act_and_assert(source_markdown, expected_gfm, expected_tokens)
5854+
5855+
5856+
@pytest.mark.gfm
5857+
def test_extra_042xb():
5858+
"""
5859+
TBD
5860+
"""
5861+
5862+
# Arrange
5863+
source_markdown = """# test
5864+
5865+
## Example: [foo]
5866+
5867+
[foo]: https://example.com
5868+
"""
5869+
expected_tokens = [
5870+
"[atx(1,1):1:0:]",
5871+
"[text(1,3):test: ]",
5872+
"[end-atx::]",
5873+
"[BLANK(2,1):]",
5874+
"[atx(3,1):2:0:]",
5875+
"[text(3,4):Example: : ]",
5876+
"[link(3,13):shortcut:https://example.com:::::foo:False::::]",
5877+
"[text(3,14):foo:]",
5878+
"[end-link::]",
5879+
"[end-atx::]",
5880+
"[BLANK(4,1):]",
5881+
"[link-ref-def(5,1):True::foo:: :https://example.com:::::]",
5882+
"[BLANK(6,1):]",
5883+
]
5884+
expected_gfm = """<h1>test</h1>
5885+
<h2>Example: <a href="https://example.com">foo</a></h2>"""
5886+
5887+
# Act & Assert
5888+
act_and_assert(source_markdown, expected_gfm, expected_tokens)
5889+
5890+
5891+
@pytest.mark.gfm
5892+
def test_extra_042xc():
5893+
"""
5894+
TBD
5895+
"""
5896+
5897+
# Arrange
5898+
source_markdown = """# test
5899+
5900+
## Example: [foo][]
5901+
5902+
[foo]: https://example.com
5903+
"""
5904+
expected_tokens = [
5905+
"[atx(1,1):1:0:]",
5906+
"[text(1,3):test: ]",
5907+
"[end-atx::]",
5908+
"[BLANK(2,1):]",
5909+
"[atx(3,1):2:0:]",
5910+
"[text(3,4):Example: : ]",
5911+
"[link(3,13):collapsed:https://example.com:::::foo:False::::]",
5912+
"[text(3,14):foo:]",
5913+
"[end-link::]",
5914+
"[end-atx::]",
5915+
"[BLANK(4,1):]",
5916+
"[link-ref-def(5,1):True::foo:: :https://example.com:::::]",
5917+
"[BLANK(6,1):]",
5918+
]
5919+
expected_gfm = """<h1>test</h1>
5920+
<h2>Example: <a href="https://example.com">foo</a></h2>"""
5921+
5922+
# Act & Assert
5923+
act_and_assert(source_markdown, expected_gfm, expected_tokens)
5924+
5925+
57505926
@pytest.mark.gfm
57515927
def test_extra_999():
57525928
"""

0 commit comments

Comments
 (0)