Repository: jackdewinter/pymarkdown

Issue:
Add extra coalescing after inline processor.
## Prerequisites

* [x] Are you running the latest version of this application?
* [x] Have you checked the [Frequently Asked Questions](https://pymarkdown.readthedocs.io/en/latest/faq) document?
* [x] Did you perform a cursory search of other issues to look for related issues?

## Feature Request

### Description

After the inline processing, there can be multiple text tokens in the token stream that can be coalesced. 

### Desired Behavior of Feature

Any multiple text tokens after inline processing should be combined.

### What Are the Benefits of This Feature?

For certain rules, it would be easier to write the rules if any text was contained within one token, instead of across multiple tokens.


Discussion:
sourcery-ai[bot]: <!-- Generated by sourcery-ai[bot]: start review_guide -->

🧙 Sourcery is reviewing your pull request!

<!-- Generated by sourcery-ai[bot]: end review_guide -->

---

<details>
<summary>Tips</summary>

- Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request.
- You can change your review settings at any time by accessing your [dashboard](https://sourcery.ai/dashboard):
    - Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    - Change the review language;
- You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.

</details>
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/jackdewinter/pymarkdown/pull/1104?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 100.00%. Comparing base [(`aec8234`)](https://app.codecov.io/gh/jackdewinter/pymarkdown/commit/aec8234c59bf6ae0c1e878a4c162df1198419306?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None) to head [(`756fc78`)](https://app.codecov.io/gh/jackdewinter/pymarkdown/commit/756fc787f996bd23ab6dc2383af68c1bb9b215d3?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).


<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff            @@
##              main     #1104   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          189       189           
  Lines        19406     19465   +59     
  Branches      2415      2426   +11     
=========================================
+ Hits         19406     19465   +59     
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/jackdewinter/pymarkdown/pull/1104?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=None).


Patch:
diff --git a/publish/coverage.json b/publish/coverage.json
index ccfad1cb..d058b5a0 100644
--- a/publish/coverage.json
+++ b/publish/coverage.json
@@ -2,12 +2,12 @@
     "projectName": "pymarkdown",
     "reportSource": "pytest",
     "branchLevel": {
-        "totalMeasured": 4831,
-        "totalCovered": 4831
+        "totalMeasured": 4853,
+        "totalCovered": 4853
     },
     "lineLevel": {
-        "totalMeasured": 19406,
-        "totalCovered": 19406
+        "totalMeasured": 19465,
+        "totalCovered": 19465
     }
 }
 
diff --git a/publish/pylint_suppression.json b/publish/pylint_suppression.json
index 954e1ea4..c606ea0e 100644
--- a/publish/pylint_suppression.json
+++ b/publish/pylint_suppression.json
@@ -327,9 +327,7 @@
         },
         "pymarkdown/plugins/rule_md_035.py": {},
         "pymarkdown/plugins/rule_md_036.py": {},
-        "pymarkdown/plugins/rule_md_037.py": {
-            "too-many-arguments": 1
-        },
+        "pymarkdown/plugins/rule_md_037.py": {},
         "pymarkdown/plugins/rule_md_038.py": {},
         "pymarkdown/plugins/rule_md_039.py": {},
         "pymarkdown/plugins/rule_md_040.py": {},
@@ -499,7 +497,7 @@
         "too-many-instance-attributes": 24,
         "too-many-public-methods": 4,
         "too-few-public-methods": 39,
-        "too-many-arguments": 227,
+        "too-many-arguments": 226,
         "too-many-locals": 38,
         "chained-comparison": 1,
         "too-many-boolean-expressions": 2,
diff --git a/pymarkdown/coalesce/coalesce_processor.py b/pymarkdown/coalesce/coalesce_processor.py
index 8868362a..fa253f14 100644
--- a/pymarkdown/coalesce/coalesce_processor.py
+++ b/pymarkdown/coalesce/coalesce_processor.py
@@ -26,7 +26,7 @@ class CoalesceProcessor:
 
     @staticmethod
     def coalesce_text_blocks(
-        first_pass_results: List[MarkdownToken],
+        first_pass_results: List[MarkdownToken], only_change_text_blocks: bool = False
     ) -> List[MarkdownToken]:
         """
         Take a pass and combine any two adjacent text blocks into one.
@@ -41,9 +41,12 @@ class CoalesceProcessor:
             if coalesced_list[-1].is_text:
                 # POGGER.debug("__coalesce_with_previous")
                 did_process = CoalesceProcessor.__coalesce_with_previous(
-                    first_pass_results, coalesced_list, coalesce_index
+                    first_pass_results,
+                    coalesced_list,
+                    coalesce_index,
+                    only_change_text_blocks,
                 )
-            else:
+            elif not only_change_text_blocks:
                 did_process = (
                     first_pass_results[coalesce_index].is_blank_line
                     and coalesced_list[-1].is_code_block
@@ -53,12 +56,15 @@ class CoalesceProcessor:
                     CoalesceProcessor.__coalesce_with_blank_line(
                         first_pass_results, coalesced_list, coalesce_index
                     )
+            else:
+                did_process = False
             if not did_process:
                 coalesced_list.append(first_pass_results[coalesce_index])
                 # POGGER.debug("coalesced_list:$:", coalesced_list)
 
         # POGGER.debug("--Final--coalesced_list:$:", coalesced_list)
-        CoalesceProcessor.__calculate_final_whitespaces(coalesced_list)
+        if not only_change_text_blocks:
+            CoalesceProcessor.__calculate_final_whitespaces(coalesced_list)
         # POGGER.debug("coalesced_list:$:", coalesced_list)
 
         return coalesced_list
@@ -96,6 +102,7 @@ class CoalesceProcessor:
         first_pass_results: List[MarkdownToken],
         coalesced_list: List[MarkdownToken],
         coalesce_index: int,
+        only_change_text_blocks: bool,
     ) -> bool:
         # POGGER.debug(">>coalesce_text_blocks>>>>$<<", coalesced_list[-1])
         if not first_pass_results[coalesce_index].is_text and (
@@ -121,7 +128,9 @@ class CoalesceProcessor:
         # POGGER.debug("combine1>>$", text_token)
         # POGGER.debug("combine2>>$", first_pass_results[coalesce_index])
         indented_whitespace = text_token.combine(
-            first_pass_results[coalesce_index], remove_leading_spaces
+            first_pass_results[coalesce_index],
+            remove_leading_spaces,
+            only_change_text_blocks,
         )
         # POGGER.debug("combined>>$", text_token)
         # POGGER.debug("indented_whitespace>>$<<", indented_whitespace)
diff --git a/pymarkdown/general/tokenized_markdown.py b/pymarkdown/general/tokenized_markdown.py
index 418d8bae..ca9e2e44 100644
--- a/pymarkdown/general/tokenized_markdown.py
+++ b/pymarkdown/general/tokenized_markdown.py
@@ -147,8 +147,11 @@ class TokenizedMarkdown:
                 coalesced_results, self.__parse_properties
             )
 
+            final_coalesced_results = CoalesceProcessor.coalesce_text_blocks(
+                final_pass_results, only_change_text_blocks=True
+            )
             POGGER.debug("\n\n>>>>>>>final_pass_results>>>>>>")
-            return final_pass_results
+            return final_coalesced_results
         except Exception as this_exception:
             raise BadTokenizationError(
                 "An unhandled error occurred processing the document."
diff --git a/pymarkdown/plugins/rule_md_037.py b/pymarkdown/plugins/rule_md_037.py
index d5220bdd..c4de9eb8 100644
--- a/pymarkdown/plugins/rule_md_037.py
+++ b/pymarkdown/plugins/rule_md_037.py
@@ -2,9 +2,10 @@
 Module to implement a plugin that looks for spaces within emphasis sections.
 """
 
+from dataclasses import dataclass
 from typing import List, Optional, Tuple, cast
 
-from pymarkdown.general.constants import Constants
+from pymarkdown.general.parser_helper import ParserHelper
 from pymarkdown.plugin_manager.plugin_details import PluginDetailsV2
 from pymarkdown.plugin_manager.plugin_scan_context import PluginScanContext
 from pymarkdown.plugin_manager.rule_plugin import RulePlugin
@@ -12,6 +13,31 @@ from pymarkdown.tokens.markdown_token import MarkdownToken
 from pymarkdown.tokens.text_markdown_token import TextMarkdownToken
 
 
+@dataclass
+class EligibleEmphasis:
+    """
+    Emphasis characters that are eligible for actual emphasis.
+    """
+
+    emphasis_character: str
+    start_index: int
+    found_length: int
+    character_before: Optional[str] = None
+    character_after: Optional[str] = None
+    text_token: Optional[TextMarkdownToken] = None
+
+
+@dataclass
+class PendingFixes:
+    """
+    Fixes that are pending being applied to the token.
+    """
+
+    token_to_modify: TextMarkdownToken
+    start_index: int
+    end_index: int
+
+
 class RuleMd037(RulePlugin):
     """
     Class to implement a plugin that looks for spaces within emphasis sections.
@@ -19,9 +45,9 @@ class RuleMd037(RulePlugin):
 
     def __init__(self) -> None:
         super().__init__()
-        self.__block_stack: List[MarkdownToken] = []
-        self.__start_emphasis_token: Optional[TextMarkdownToken] = None
-        self.__emphasis_token_list: List[MarkdownToken] = []
+        self.__pending_fixes: List[PendingFixes] = []
+        self.__block_token: Optional[MarkdownToken] = None
+        self.__past_emphasis_list: List[EligibleEmphasis] = []
 
     def get_details(self) -> PluginDetailsV2:
         """
@@ -41,142 +67,201 @@ class RuleMd037(RulePlugin):
         """
         Event that the a new file to be scanned is starting.
         """
-        self.__block_stack = []
-        self.__start_emphasis_token = None
-        self.__emphasis_token_list = []
+        self.__block_token = None
+        self.__past_emphasis_list = []
 
-    # pylint: disable=too-many-arguments
-    def __fix(
-        self,
-        context: PluginScanContext,
-        start_token: Optional[TextMarkdownToken],
-        end_token: Optional[TextMarkdownToken],
-        did_first_start_with_space: bool,
-        did_last_end_with_space: bool,
+    def next_token(self, context: PluginScanContext, token: MarkdownToken) -> None:
+        """
+        Event that a new token is being processed.
+        """
+        if token.is_paragraph or token.is_setext_heading or token.is_atx_heading:
+            self.__block_token = token
+            self.__past_emphasis_list = []
+        elif (
+            token.is_paragraph_end
+            or token.is_setext_heading_end
+            or token.is_atx_heading_end
+        ):
+            self.__block_token = None
+            self.__past_emphasis_list = []
+            if self.__pending_fixes:
+                self.__process_fixes(context)
+        elif (
+            token.is_text
+            and self.__block_token is not None
+            and (
+                self.__block_token.is_paragraph
+                or self.__block_token.is_setext_heading
+                or self.__block_token.is_atx_heading
+            )
+        ):
+            text_token = cast(TextMarkdownToken, token)
+            self.__check_text_token(context, text_token)
+
+    def __check_text_token(
+        self, context: PluginScanContext, text_token: TextMarkdownToken
     ) -> None:
-        if start_token == end_token:
-            assert start_token is not None
-            adjusted_token_text = start_token.token_text
-            if did_first_start_with_space:
-                adjusted_token_text = adjusted_token_text.lstrip(
-                    Constants.unicode_whitespace.value()
-                )
-            if did_last_end_with_space:
-                adjusted_token_text = adjusted_token_text.rstrip(
-                    Constants.unicode_whitespace.value()
-                )
-            self.register_fix_token_request(
-                context,
-                start_token,
-                "next_token",
-                "token_text",
-                adjusted_token_text,
+        start_index = 0
+        next_index: Optional[int] = -1
+        while next_index is not None:
+            new_emphasis, next_index = self.__find_next_eligible_emphasis(
+                text_token, start_index
             )
-        else:
-            if did_first_start_with_space:
-                assert start_token is not None
-                adjusted_token_text = start_token.token_text.lstrip(
-                    Constants.unicode_whitespace.value()
-                )
-                self.register_fix_token_request(
-                    context,
-                    start_token,
-                    "next_token",
-                    "token_text",
-                    adjusted_token_text,
-                )
-            if did_last_end_with_space:
-                assert end_token is not None
-                adjusted_token_text = end_token.token_text.rstrip(
-                    Constants.unicode_whitespace.value()
-                )
-                self.register_fix_token_request(
-                    context,
-                    end_token,
-                    "next_token",
-                    "token_text",
-                    adjusted_token_text,
+            if new_emphasis is not None:
+                if (
+                    self.__past_emphasis_list
+                    and self.__past_emphasis_list[-1].emphasis_character
+                    == new_emphasis.emphasis_character
+                    and self.__past_emphasis_list[-1].found_length
+                    == new_emphasis.found_length
+                ):
+                    self.__check(context, self.__past_emphasis_list[-1], new_emphasis)
+                    del self.__past_emphasis_list[-1]
+                else:
+                    self.__past_emphasis_list.append(new_emphasis)
+            if next_index is not None:
+                found_emphasis_length = (
+                    new_emphasis.found_length if new_emphasis is not None else 1
                 )
+                start_index = next_index + 1 + found_emphasis_length
+
+    def __check(
+        self,
+        context: PluginScanContext,
+        elibible_before: EligibleEmphasis,
+        eligible_after: EligibleEmphasis,
+    ) -> None:
+        if elibible_before.character_after == " ":
+            if context.in_fix_mode:
+                assert elibible_before.text_token is not None
+                self.__fix(elibible_before.text_token, elibible_before, True)
+            else:
+                self.__report(context, elibible_before, eligible_after.found_length)
+        if eligible_after.character_before == " ":
+            if context.in_fix_mode:
+                assert eligible_after.text_token is not None
+                self.__fix(eligible_after.text_token, eligible_after, False)
+            else:
+                self.__report(context, eligible_after, -1)
 
-    # pylint: enable=too-many-arguments
-
-    def __handle_emphasis_text(
-        self, context: PluginScanContext, token: MarkdownToken
-    ) -> None:  # sourcery skip: extract-method
-        text_token = cast(TextMarkdownToken, token)
-        assert self.__start_emphasis_token is not None
-        if text_token.token_text == self.__start_emphasis_token.token_text:
-            assert self.__emphasis_token_list
-            (
-                start_token,
-                did_first_start_with_space,
-            ) = self.__handle_emphasis_text_space_check(0)
-            (
-                end_token,
-                did_last_end_with_space,
-            ) = self.__handle_emphasis_text_space_check(-1)
-            if did_first_start_with_space or did_last_end_with_space:
-                assert self.__start_emphasis_token is not None
-                if context.in_fix_mode:
-                    self.__fix(
-                        context,
-                        start_token,
-                        end_token,
-                        did_first_start_with_space,
-                        did_last_end_with_space,
+    def __process_fixes(self, context: PluginScanContext) -> None:
+        current_token = None
+        current_text = ""
+        current_delta = 0
+        for new_bob in self.__pending_fixes:
+            if current_token != new_bob.token_to_modify:
+                if current_token is not None:
+                    self.register_fix_token_request(
+                        context, current_token, "next_token", "token_text", current_text
                     )
-                else:
-                    self.report_next_token_error(context, self.__start_emphasis_token)
+                current_token = new_bob.token_to_modify
+                current_text = current_token.token_text
+                current_delta = 0
+            current_text = (
+                current_text[: new_bob.start_index - current_delta]
+                + current_text[new_bob.end_index - current_delta :]
+            )
+            current_delta += new_bob.end_index - new_bob.start_index
+        assert current_token is not None
+        self.register_fix_token_request(
+            context, current_token, "next_token", "token_text", current_text
+        )
+        self.__pending_fixes.clear()
 
-            self.__start_emphasis_token = None
-            self.__emphasis_token_list = []
+    def __fix(
+        self,
+        token: TextMarkdownToken,
+        eligible_after: EligibleEmphasis,
+        was_after: bool,
+    ) -> None:
+        if was_after:
+            start_fix_index = eligible_after.start_index + eligible_after.found_length
+            end_fix_index, _ = ParserHelper.collect_while_one_of_characters_verified(
+                token.token_text, start_fix_index, " \t"
+            )
         else:
-            self.__emphasis_token_list.append(token)
-
-    def __handle_emphasis_text_space_check(
-        self, token_text_index: int
-    ) -> Tuple[Optional[TextMarkdownToken], bool]:
-        first_capture_token = self.__emphasis_token_list[token_text_index]
-        if not first_capture_token.is_text:
-            return None, False
-        other_text_token = cast(TextMarkdownToken, first_capture_token)
-        return other_text_token, other_text_token.token_text[token_text_index] == " "
-
-    def __handle_start_emphasis(
-        self, context: PluginScanContext, token: MarkdownToken
+            _, start_fix_index = (
+                ParserHelper.collect_backwards_while_one_of_characters_verified(
+                    token.token_text, eligible_after.start_index - 1, " \t"
+                )
+            )
+            end_fix_index = eligible_after.start_index
+        self.__pending_fixes.append(PendingFixes(token, start_fix_index, end_fix_index))
+
+    def __report(
+        self,
+        context: PluginScanContext,
+        elibible_before: EligibleEmphasis,
+        column_adjust: int,
     ) -> None:
+        assert elibible_before.text_token is not None
+        before_eligible_text = elibible_before.text_token.token_text[
+            : elibible_before.start_index
+        ]
+        adj_before_eligible_text = ParserHelper.remove_all_from_text(
+            before_eligible_text
+        )
+        line_number_delta = ParserHelper.count_newlines_in_text(
+            adj_before_eligible_text
+        )
+        if line_number_delta:
+            last_newline_index = adj_before_eligible_text.rindex("\n") + 1
+            column_number_delta = len(adj_before_eligible_text) - last_newline_index
+        else:
+            column_number_delta = len(adj_before_eligible_text)
+        self.report_next_token_error(
+            context,
+            elibible_before.text_token,
+            line_number_delta=line_number_delta,
+            column_number_delta=(column_number_delta + column_adjust),
+        )
+
+    def __find_next_eligible_emphasis(
+        self, text_token: TextMarkdownToken, start_index: int
+    ) -> Tuple[Optional[EligibleEmphasis], Optional[int]]:
+
+        asterisk_index = text_token.token_text.find("*", start_index)
+        underscore_index = text_token.token_text.find("_", start_index)
+        if asterisk_index == -1 and underscore_index == -1:
+            return None, None
+
         if (
-            token.is_paragraph_end
-            or token.is_setext_heading_end
-            or token.is_atx_heading_end
+            asterisk_index != -1
+            and underscore_index != -1
+            and asterisk_index < underscore_index
+            or asterisk_index != -1
+            and underscore_index == -1
         ):
-            del self.__block_stack[-1]
-            self.__start_emphasis_token = None
-            self.__emphasis_token_list = []
-        elif token.is_text and self.__start_emphasis_token is not None:
-            self.__handle_emphasis_text(context, token)
+            start_index = asterisk_index
+            emphasis_character = "*"
         else:
-            self.__emphasis_token_list.append(token)
+            start_index = underscore_index
+            emphasis_character = "_"
 
-    def next_token(self, context: PluginScanContext, token: MarkdownToken) -> None:
-        """
-        Event that a new token is being processed.
-        """
-        if self.__start_emphasis_token:
-            self.__handle_start_emphasis(context, token)
-        elif token.is_paragraph or token.is_setext_heading or token.is_atx_heading:
-            self.__block_stack.append(token)
-        elif token.is_paragraph_end or token.is_setext_heading_end:
-            del self.__block_stack[-1]
-        elif (
-            token.is_text
-            and self.__block_stack
-            and (
-                self.__block_stack[-1].is_paragraph
-                or self.__block_stack[-1].is_setext_heading
-                or self.__block_stack[-1].is_atx_heading
-            )
-        ):
-            text_token = cast(TextMarkdownToken, token)
-            if text_token.token_text in ("*", "**", "_", "__"):
-                self.__start_emphasis_token = text_token
+        character_before = (
+            text_token.token_text[start_index - 1] if start_index else None
+        )
+        if character_before == "\b":
+            return None, start_index
+        found_length, _ = ParserHelper.collect_while_character_verified(
+            text_token.token_text, start_index, emphasis_character
+        )
+        after_index = start_index + found_length
+        character_after = (
+            text_token.token_text[after_index]
+            if after_index < len(text_token.token_text)
+            else None
+        )
+        if character_before == "\a" and character_after == "\a":
+            return None, start_index
+        return (
+            EligibleEmphasis(
+                emphasis_character,
+                start_index,
+                found_length,
+                character_before,
+                character_after,
+                text_token,
+            ),
+            start_index,
+        )
diff --git a/pymarkdown/tokens/text_markdown_token.py b/pymarkdown/tokens/text_markdown_token.py
index 8ca068e0..93eca943 100644
--- a/pymarkdown/tokens/text_markdown_token.py
+++ b/pymarkdown/tokens/text_markdown_token.py
@@ -188,7 +188,10 @@ class TextMarkdownToken(InlineMarkdownToken):
         return removed_whitespace
 
     def combine(
-        self, other_text_token: MarkdownToken, remove_leading_spaces: int
+        self,
+        other_text_token: MarkdownToken,
+        remove_leading_spaces: int,
+        only_change_text_blocks: bool,
     ) -> str:
         """
         Combine the two text tokens together with a line feed between.
@@ -198,6 +201,10 @@ class TextMarkdownToken(InlineMarkdownToken):
         If remove_leading_spaces == 0, then.
         """
 
+        # if self.line_number == other_text_token.line_number:
+        if only_change_text_blocks:
+
+            return self.__combine_only_text_blocks(other_text_token)
         if other_text_token.is_blank_line:
             text_to_combine = ""
             tabified_text_to_combine: Optional[str] = ""
@@ -233,11 +240,6 @@ class TextMarkdownToken(InlineMarkdownToken):
             other_token_text = tabified_text_to_combine or text_to_combine
 
             this_token_text = self.__tabified_text or self.__token_text
-            # POGGER.debug("this_token_text>:$:<", this_token_text)
-            # POGGER.debug("blank_line_sequence>:$:<", blank_line_sequence)
-            # POGGER.debug("prefix_whitespace>:$:<", prefix_whitespace)
-            # POGGER.debug("other_token_text>:$:<", other_token_text)
-
             self.__tabified_text = (
                 f"{this_token_text}{ParserHelper.newline_character}{blank_line_sequence}"
                 + f"{prefix_whitespace}{other_token_text}"
@@ -249,6 +251,22 @@ class TextMarkdownToken(InlineMarkdownToken):
         self.__compose_extra_data_field()
         return removed_whitespace
 
+    def __combine_only_text_blocks(self, other_text_token: MarkdownToken) -> str:
+        the_other_text_token = cast(TextMarkdownToken, other_text_token)
+        assert the_other_text_token is not None
+        self.__token_text = self.token_text + the_other_text_token.token_text
+        self.__extracted_whitespace = (
+            self.extracted_whitespace + the_other_text_token.extracted_whitespace
+        )
+        if the_other_text_token.end_whitespace is not None:
+            self.__end_whitespace = (
+                (self.end_whitespace + the_other_text_token.end_whitespace)
+                if self.end_whitespace is not None
+                else the_other_text_token.end_whitespace
+            )
+        self.__compose_extra_data_field()
+        return ""
+
     def __combine_handle_whitespace(
         self, remove_leading_spaces: int, whitespace_present: str
     ) -> Tuple[str, str]:


Test patch:
diff --git a/publish/test-results.json b/publish/test-results.json
index 46ae6a4b..54943169 100644
--- a/publish/test-results.json
+++ b/publish/test-results.json
@@ -1412,7 +1412,7 @@
         },
         {
             "name": "test.rules.test_md037",
-            "totalTests": 42,
+            "totalTests": 56,
             "failedTests": 0,
             "errorTests": 0,
             "skippedTests": 0,
@@ -1620,7 +1620,7 @@
         },
         {
             "name": "test.test_markdown_extra",
-            "totalTests": 146,
+            "totalTests": 148,
             "failedTests": 0,
             "errorTests": 0,
             "skippedTests": 0,
diff --git a/test/extensions/test_disallowed_html.py b/test/extensions/test_disallowed_html.py
index 4cddc714..674295d8 100644
--- a/test/extensions/test_disallowed_html.py
+++ b/test/extensions/test_disallowed_html.py
@@ -1093,9 +1093,7 @@ def test_disallowed_html_raw_enabled():
     source_markdown = "This is a <noframes> example."
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):This is a :]",
-        "[text(1,11):\a<\a&lt;\anoframes>:]",
-        "[text(1,21): example.:]",
+        "[text(1,1):This is a \a<\a&lt;\anoframes> example.:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>This is a &lt;noframes> example.</p>"""
@@ -1160,9 +1158,7 @@ def test_disallowed_html_raw_with_attributes_enabled():
     source_markdown = "This is a <noframes some=True> example."
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):This is a :]",
-        "[text(1,11):\a<\a&lt;\anoframes some=True>:]",
-        "[text(1,31): example.:]",
+        "[text(1,1):This is a \a<\a&lt;\anoframes some=True> example.:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>This is a &lt;noframes some=True> example.</p>"""
@@ -1204,9 +1200,7 @@ def test_disallowed_html_raw_with_openclose_enabled():
     source_markdown = "This is a <noframes/> example."
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):This is a :]",
-        "[text(1,11):\a<\a&lt;\anoframes/>:]",
-        "[text(1,22): example.:]",
+        "[text(1,1):This is a \a<\a&lt;\anoframes/> example.:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>This is a &lt;noframes/> example.</p>"""
diff --git a/test/gfm/test_markdown_autolinks.py b/test/gfm/test_markdown_autolinks.py
index 8ca96a87..2a79dff1 100644
--- a/test/gfm/test_markdown_autolinks.py
+++ b/test/gfm/test_markdown_autolinks.py
@@ -515,9 +515,7 @@ def test_autolinks_620c():
     source_markdown = """<my_scheme:foo.bar>"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):\a<\a&lt;\amy:]",
-        "[text(1,4):_:]",
-        "[text(1,5):scheme:foo.bar\a>\a&gt;\a:]",
+        "[text(1,1):\a<\a&lt;\amy_scheme:foo.bar\a>\a&gt;\a:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>&lt;my_scheme:foo.bar&gt;</p>"""
@@ -536,9 +534,7 @@ def test_autolinks_620d():
     source_markdown = """<no_domain@>"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):\a<\a&lt;\ano:]",
-        "[text(1,4):_:]",
-        "[text(1,5):domain@\a>\a&gt;\a:]",
+        "[text(1,1):\a<\a&lt;\ano_domain@\a>\a&gt;\a:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>&lt;no_domain@&gt;</p>"""
diff --git a/test/gfm/test_markdown_autolinks_extension.py b/test/gfm/test_markdown_autolinks_extension.py
index 91c678e3..ab70998e 100644
--- a/test/gfm/test_markdown_autolinks_extension.py
+++ b/test/gfm/test_markdown_autolinks_extension.py
@@ -212,9 +212,7 @@ def test_autolinks_621ib():
     source_markdown = """ www.a.b_c.d """
     expected_tokens = [
         "[para(1,2): : ]",
-        "[text(1,2):www.a.b:]",
-        "[text(1,9):_:]",
-        "[text(1,10):c.d:]",
+        "[text(1,2):www.a.b_c.d:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>www.a.b_c.d</p>"""
@@ -234,9 +232,7 @@ def test_autolinks_621ic():
     source_markdown = """ www.a.b.c_d """
     expected_tokens = [
         "[para(1,2): : ]",
-        "[text(1,2):www.a.b.c:]",
-        "[text(1,11):_:]",
-        "[text(1,12):d:]",
+        "[text(1,2):www.a.b.c_d:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>www.a.b.c_d</p>"""
@@ -461,10 +457,7 @@ Visit www.commonmark.org~ now!"""
         "[uri-autolink(4,7):1:www.commonmark.org]",
         "[text(4,25):: the best!\nVisit ::\n]",
         "[uri-autolink(5,7):1:www.commonmark.org]",
-        "[text(5,25):*:]",
-        "[text(5,26): now!\nVisit www.commonmark.org::\n]",
-        "[text(6,25):_:]",
-        "[text(6,26): now!\nVisit ::\n]",
+        "[text(5,25):* now!\nVisit www.commonmark.org_ now!\nVisit ::\n\n]",
         "[uri-autolink(7,7):1:www.commonmark.org]",
         "[text(7,25):~ now!:]",
         "[end-para:::True]",
@@ -508,11 +501,9 @@ Visit www.commonmark.org/a=b~ now!"""
         "[uri-autolink(4,7):1:www.commonmark.org/a=b]",
         "[text(4,29):: the best!\nVisit ::\n]",
         "[uri-autolink(5,7):1:www.commonmark.org/a=b]",
-        "[text(5,29):*:]",
-        "[text(5,30): now!\nVisit ::\n]",
+        "[text(5,29):* now!\nVisit ::\n]",
         "[uri-autolink(6,7):1:www.commonmark.org/a=b]",
-        "[text(6,29):_:]",
-        "[text(6,30): now!\nVisit ::\n]",
+        "[text(6,29):_ now!\nVisit ::\n]",
         "[uri-autolink(7,7):1:www.commonmark.org/a=b]",
         "[text(7,29):~ now!:]",
         "[end-para:::True]",
@@ -1140,16 +1131,11 @@ a.b-c_d@a.b_"""
         "[end-para:::True]",
         "[BLANK(4,1):]",
         "[para(5,1):]",
-        "[text(5,1):a.b-c:]",
-        "[text(5,6):_:]",
-        "[text(5,7):d@a.b-:]",
+        "[text(5,1):a.b-c_d@a.b-:]",
         "[end-para:::True]",
         "[BLANK(6,1):]",
         "[para(7,1):]",
-        "[text(7,1):a.b-c:]",
-        "[text(7,6):_:]",
-        "[text(7,7):d@a.b:]",
-        "[text(7,12):_:]",
+        "[text(7,1):a.b-c_d@a.b_:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p><a href="mailto:a.b-c_d@a.b">a.b-c_d@a.b</a></p>
@@ -1204,16 +1190,11 @@ xmpp:foo@bar.baz."""
         "[end-para:::True]",
         "[BLANK(8,1):]",
         "[para(9,1):]",
-        "[text(9,1):mailto:a.b-c:]",
-        "[text(9,13):_:]",
-        "[text(9,14):d@a.b-:]",
+        "[text(9,1):mailto:a.b-c_d@a.b-:]",
         "[end-para:::True]",
         "[BLANK(10,1):]",
         "[para(11,1):]",
-        "[text(11,1):mailto:a.b-c:]",
-        "[text(11,13):_:]",
-        "[text(11,14):d@a.b:]",
-        "[text(11,19):_:]",
+        "[text(11,1):mailto:a.b-c_d@a.b_:]",
         "[end-para:::True]",
         "[BLANK(12,1):]",
         "[para(13,1):]",
diff --git a/test/gfm/test_markdown_backslash_escapes.py b/test/gfm/test_markdown_backslash_escapes.py
index 3960dcb3..afac932a 100644
--- a/test/gfm/test_markdown_backslash_escapes.py
+++ b/test/gfm/test_markdown_backslash_escapes.py
@@ -63,19 +63,7 @@ def test_backslash_escapes_310():
 \\&ouml; not a character entity"""
     expected_tokens = [
         "[para(1,1):\n\n\n\n\n\n\n\n]",
-        "[text(1,1):\\\b*not emphasized:]",
-        "[text(1,17):*:]",
-        "[text(1,18):\n\\\b\a<\a&lt;\abr/\a>\a&gt;\a not a tag\n\\\b[not a link::\n\n]",
-        "[text(3,13):]:]",
-        """[text(3,14):(/foo)
-\\\b`not code`
-1\\\b. not a list
-\\\b* not a list
-\\\b# not a heading
-\\\b[foo::\n\n\n\n\n]""",
-        "[text(8,6):]:]",
-        """[text(8,7):: /url \a\"\a&quot;\anot a reference\a\"\a&quot;\a
-\\\b\a&\a&amp;\aouml; not a character entity::\n]""",
+        '[text(1,1):\\\b*not emphasized*\n\\\b\a<\a&lt;\abr/\a>\a&gt;\a not a tag\n\\\b[not a link](/foo)\n\\\b`not code`\n1\\\b. not a list\n\\\b* not a list\n\\\b# not a heading\n\\\b[foo]: /url \a"\a&quot;\anot a reference\a"\a&quot;\a\n\\\b\a&\a&amp;\aouml; not a character entity::\n\n\n\n\n\n\n\n]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>*not emphasized*
diff --git a/test/gfm/test_markdown_backslash_escapes_extra.py b/test/gfm/test_markdown_backslash_escapes_extra.py
index f1fda39c..0b72237f 100644
--- a/test/gfm/test_markdown_backslash_escapes_extra.py
+++ b/test/gfm/test_markdown_backslash_escapes_extra.py
@@ -151,9 +151,7 @@ def test_backslash_escapes_extra_7():
     source_markdown = """\\*it's* me!"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):\\\b*it's:]",
-        "[text(1,7):*:]",
-        "[text(1,8): me!:]",
+        "[text(1,1):\\\b*it's* me!:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>*it's* me!</p>"""
@@ -172,8 +170,7 @@ def test_backslash_escapes_extra_8():
     source_markdown = """*it's\\* me!"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):*:]",
-        "[text(1,2):it's\\\b* me!:]",
+        "[text(1,1):*it's\\\b* me!:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>*it's* me!</p>"""
@@ -195,8 +192,7 @@ def test_backslash_escapes_extra_9():
         "[emphasis(1,1):1:*]",
         "[text(1,2):\\\b*it's:]",
         "[end-emphasis(1,8)::]",
-        "[text(1,9):*:]",
-        "[text(1,10): me!:]",
+        "[text(1,9):* me!:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p><em>*it's</em>* me!</p>"""
@@ -238,9 +234,7 @@ def test_backslash_escapes_extra_11():
     source_markdown = """\\[Foo](/uri) is a link"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):\\\b[Foo:]",
-        "[text(1,6):]:]",
-        "[text(1,7):(/uri) is a link:]",
+        "[text(1,1):\\\b[Foo](/uri) is a link:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[Foo](/uri) is a link</p>"""
@@ -283,9 +277,7 @@ def test_backslash_escapes_extra_13():
     source_markdown = """!\\[foo](/url "title") is an image"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):!\\\b[foo:]",
-        "[text(1,7):]:]",
-        '[text(1,8):(/url \a"\a&quot;\atitle\a"\a&quot;\a) is an image:]',
+        '[text(1,1):!\\\b[foo](/url \a"\a&quot;\atitle\a"\a&quot;\a) is an image:]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>![foo](/url &quot;title&quot;) is an image</p>"""
@@ -446,9 +438,7 @@ def test_backslash_escapes_extra_20():
 ---"""
     expected_tokens = [
         "[setext(2,1):-:3::(1,1)]",
-        "[text(1,1):\\\b*it's:]",
-        "[text(1,7):*:]",
-        "[text(1,8): me!:]",
+        "[text(1,1):\\\b*it's* me!:]",
         "[end-setext::]",
     ]
     expected_gfm = """<h2>*it's* me!</h2>"""
@@ -468,8 +458,7 @@ def test_backslash_escapes_extra_21():
 ---"""
     expected_tokens = [
         "[setext(2,1):-:3::(1,1)]",
-        "[text(1,1):*:]",
-        "[text(1,2):it's\\\b* me!:]",
+        "[text(1,1):*it's\\\b* me!:]",
         "[end-setext::]",
     ]
     expected_gfm = """<h2>*it's* me!</h2>"""
@@ -492,8 +481,7 @@ def test_backslash_escapes_extra_22():
         "[emphasis(1,1):1:*]",
         "[text(1,2):\\\b*it's:]",
         "[end-emphasis(1,8)::]",
-        "[text(1,9):*:]",
-        "[text(1,10): me!:]",
+        "[text(1,9):* me!:]",
         "[end-setext::]",
     ]
     expected_gfm = """<h2><em>*it's</em>* me!</h2>"""
@@ -537,9 +525,7 @@ def test_backslash_escapes_extra_24():
 ---"""
     expected_tokens = [
         "[setext(2,1):-:3::(1,1)]",
-        "[text(1,1):\\\b[Foo:]",
-        "[text(1,6):]:]",
-        "[text(1,7):(/uri) is a link:]",
+        "[text(1,1):\\\b[Foo](/uri) is a link:]",
         "[end-setext::]",
     ]
     expected_gfm = """<h2>[Foo](/uri) is a link</h2>"""
@@ -583,9 +569,7 @@ def test_backslash_escapes_extra_26():
 ---"""
     expected_tokens = [
         "[setext(2,1):-:3::(1,1)]",
-        "[text(1,1):!\\\b[foo:]",
-        "[text(1,7):]:]",
-        '[text(1,8):(/url \a"\a&quot;\atitle\a"\a&quot;\a) is an image:]',
+        '[text(1,1):!\\\b[foo](/url \a"\a&quot;\atitle\a"\a&quot;\a) is an image:]',
         "[end-setext::]",
     ]
     expected_gfm = """<h2>![foo](/url &quot;title&quot;) is an image</h2>"""
@@ -738,13 +722,7 @@ def test_backslash_escapes_extra_33():
 
     # Arrange
     source_markdown = """# \\*it's* me!"""
-    expected_tokens = [
-        "[atx(1,1):1:0:]",
-        "[text(1,3):\\\b*it's: ]",
-        "[text(1,9):*:]",
-        "[text(1,10): me!:]",
-        "[end-atx::]",
-    ]
+    expected_tokens = ["[atx(1,1):1:0:]", "[text(1,3):\\\b*it's* me!: ]", "[end-atx::]"]
     expected_gfm = """<h1>*it's* me!</h1>"""
 
     # Act & Assert
@@ -761,9 +739,7 @@ def test_backslash_escapes_extra_34():
     source_markdown = """# *it's\\* me!"""
     expected_tokens = [
         "[atx(1,1):1:0:]",
-        "[text(1,3)::\a \a\x03\a]",
-        "[text(1,3):*:]",
-        "[text(1,4):it's\\\b* me!:]",
+        "[text(1,3):*it's\\\b* me!:\a \a\x03\a]",
         "[end-atx::]",
     ]
     expected_gfm = """<h1>*it's* me!</h1>"""
@@ -786,8 +762,7 @@ def test_backslash_escapes_extra_35():
         "[emphasis(1,3):1:*]",
         "[text(1,4):\\\b*it's:]",
         "[end-emphasis(1,10)::]",
-        "[text(1,11):*:]",
-        "[text(1,12): me!:]",
+        "[text(1,11):* me!:]",
         "[end-atx::]",
     ]
     expected_gfm = """<h1><em>*it's</em>* me!</h1>"""
@@ -806,8 +781,7 @@ def test_backslash_escapes_extra_36():
     source_markdown = """# **it's\\** me!"""
     expected_tokens = [
         "[atx(1,1):1:0:]",
-        "[text(1,3)::\a \a\x03\a]",
-        "[text(1,3):*:]",
+        "[text(1,3):*:\a \a\x03\a]",
         "[emphasis(1,4):1:*]",
         "[text(1,5):it's\\\b*:]",
         "[end-emphasis(1,11)::]",
@@ -830,9 +804,7 @@ def test_backslash_escapes_extra_37():
     source_markdown = """# \\[Foo](/uri) is a link"""
     expected_tokens = [
         "[atx(1,1):1:0:]",
-        "[text(1,3):\\\b[Foo: ]",
-        "[text(1,8):]:]",
-        "[text(1,9):(/uri) is a link:]",
+        "[text(1,3):\\\b[Foo](/uri) is a link: ]",
         "[end-atx::]",
     ]
     expected_gfm = """<h1>[Foo](/uri) is a link</h1>"""
@@ -874,9 +846,7 @@ def test_backslash_escapes_extra_39():
     source_markdown = """# !\\[foo](/url "title") is an image"""
     expected_tokens = [
         "[atx(1,1):1:0:]",
-        "[text(1,3):!\\\b[foo: ]",
-        "[text(1,9):]:]",
-        '[text(1,10):(/url \a"\a&quot;\atitle\a"\a&quot;\a) is an image:]',
+        '[text(1,3):!\\\b[foo](/url \a"\a&quot;\atitle\a"\a&quot;\a) is an image: ]',
         "[end-atx::]",
     ]
     expected_gfm = """<h1>![foo](/url &quot;title&quot;) is an image</h1>"""
diff --git a/test/gfm/test_markdown_block_quotes.py b/test/gfm/test_markdown_block_quotes.py
index 2e79f476..5f7cb7f2 100644
--- a/test/gfm/test_markdown_block_quotes.py
+++ b/test/gfm/test_markdown_block_quotes.py
@@ -2698,9 +2698,7 @@ def test_block_quotes_extra_03ab():
         "[BLANK(2,1):]",
         "[block-quote(3,1)::> ]",
         "[para(3,3):]",
-        "[text(3,3):[:]",
-        "[text(3,4):foo:]",
-        "[text(3,7):]:]",
+        "[text(3,3):[foo]:]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
diff --git a/test/gfm/test_markdown_code_spans.py b/test/gfm/test_markdown_code_spans.py
index 65072742..8471f40f 100644
--- a/test/gfm/test_markdown_code_spans.py
+++ b/test/gfm/test_markdown_code_spans.py
@@ -594,8 +594,7 @@ def test_code_spans_351():
     source_markdown = """*foo`*`"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):*:]",
-        "[text(1,2):foo:]",
+        "[text(1,1):*foo:]",
         "[icode-span(1,5):*:`::]",
         "[end-para:::True]",
     ]
@@ -615,8 +614,7 @@ def test_code_spans_352():
     source_markdown = """[not a `link](/foo`)"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):not a :]",
+        "[text(1,1):[not a :]",
         "[icode-span(1,8):link](/foo:`::]",
         "[text(1,20):):]",
         "[end-para:::True]",
diff --git a/test/gfm/test_markdown_disallowed_raw_html_extension.py b/test/gfm/test_markdown_disallowed_raw_html_extension.py
index c2a75c25..941cd59d 100644
--- a/test/gfm/test_markdown_disallowed_raw_html_extension.py
+++ b/test/gfm/test_markdown_disallowed_raw_html_extension.py
@@ -24,11 +24,7 @@ def test_disallowed_raw_html_extension_657():
     expected_tokens = [
         "[para(1,1):]",
         "[raw-html(1,1):strong]",
-        "[text(1,9): :]",
-        "[text(1,10):\a<\a&lt;\atitle>:]",
-        "[text(1,17): :]",
-        "[text(1,18):\a<\a&lt;\astyle>:]",
-        "[text(1,25): :]",
+        "[text(1,9): \a<\a&lt;\atitle> \a<\a&lt;\astyle> :]",
         "[raw-html(1,26):em]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
diff --git a/test/gfm/test_markdown_emphasis_rule_1.py b/test/gfm/test_markdown_emphasis_rule_1.py
index 23b4cea9..d1a6d3a8 100644
--- a/test/gfm/test_markdown_emphasis_rule_1.py
+++ b/test/gfm/test_markdown_emphasis_rule_1.py
@@ -39,14 +39,7 @@ def test_emphasis_361():
 
     # Arrange
     source_markdown = """a * foo bar*"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):a :]",
-        "[text(1,3):*:]",
-        "[text(1,4): foo bar:]",
-        "[text(1,12):*:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):a * foo bar*:]", "[end-para:::True]"]
     expected_gfm = """<p>a * foo bar*</p>"""
 
     # Act & Assert
@@ -65,10 +58,7 @@ def test_emphasis_362():
     source_markdown = """a*"foo"*"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):*:]",
-        '[text(1,3):\a"\a&quot;\afoo\a"\a&quot;\a:]',
-        "[text(1,8):*:]",
+        '[text(1,1):a*\a"\a&quot;\afoo\a"\a&quot;\a*:]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a*&quot;foo&quot;*</p>"""
@@ -87,9 +77,7 @@ def test_emphasis_363():
     source_markdown = """*\u00A0a\u00A0*"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):*:]",
-        "[text(1,2):\u00A0a\u00A0:]",
-        "[text(1,5):*:]",
+        "[text(1,1):*\u00A0a\u00A0*:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>*\u00A0a\u00A0*</p>"""
diff --git a/test/gfm/test_markdown_emphasis_rule_10.py b/test/gfm/test_markdown_emphasis_rule_10.py
index c0b63522..356d83a4 100644
--- a/test/gfm/test_markdown_emphasis_rule_10.py
+++ b/test/gfm/test_markdown_emphasis_rule_10.py
@@ -317,8 +317,7 @@ def test_emphasis_443():
     source_markdown = """__ is not an empty emphasis"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):__:]",
-        "[text(1,3): is not an empty emphasis:]",
+        "[text(1,1):__ is not an empty emphasis:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>__ is not an empty emphasis</p>"""
@@ -337,8 +336,7 @@ def test_emphasis_444():
     source_markdown = """____ is not an empty strong emphasis"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):____:]",
-        "[text(1,5): is not an empty strong emphasis:]",
+        "[text(1,1):____ is not an empty strong emphasis:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>____ is not an empty strong emphasis</p>"""
diff --git a/test/gfm/test_markdown_emphasis_rule_11.py b/test/gfm/test_markdown_emphasis_rule_11.py
index d7cb0af0..4409064d 100644
--- a/test/gfm/test_markdown_emphasis_rule_11.py
+++ b/test/gfm/test_markdown_emphasis_rule_11.py
@@ -15,12 +15,7 @@ def test_emphasis_445():
 
     # Arrange
     source_markdown = """foo ***"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):foo :]",
-        "[text(1,5):***:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):foo ***:]", "[end-para:::True]"]
     expected_gfm = """<p>foo ***</p>"""
 
     # Act & Assert
@@ -79,12 +74,7 @@ def test_emphasis_448():
 
     # Arrange
     source_markdown = """foo *****"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):foo :]",
-        "[text(1,5):*****:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):foo *****:]", "[end-para:::True]"]
     expected_gfm = """<p>foo *****</p>"""
 
     # Act & Assert
diff --git a/test/gfm/test_markdown_emphasis_rule_12.py b/test/gfm/test_markdown_emphasis_rule_12.py
index adad6fbd..1902530e 100644
--- a/test/gfm/test_markdown_emphasis_rule_12.py
+++ b/test/gfm/test_markdown_emphasis_rule_12.py
@@ -15,12 +15,7 @@ def test_emphasis_457():
 
     # Arrange
     source_markdown = """foo ___"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):foo :]",
-        "[text(1,5):___:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):foo ___:]", "[end-para:::True]"]
     expected_gfm = """<p>foo ___</p>"""
 
     # Act & Assert
@@ -79,12 +74,7 @@ def test_emphasis_460():
 
     # Arrange
     source_markdown = """foo _____"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):foo :]",
-        "[text(1,5):_____:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):foo _____:]", "[end-para:::True]"]
     expected_gfm = """<p>foo _____</p>"""
 
     # Act & Assert
diff --git a/test/gfm/test_markdown_emphasis_rule_14_to_17.py b/test/gfm/test_markdown_emphasis_rule_14_to_17.py
index 58335544..77bbc04a 100644
--- a/test/gfm/test_markdown_emphasis_rule_14_to_17.py
+++ b/test/gfm/test_markdown_emphasis_rule_14_to_17.py
@@ -66,12 +66,9 @@ def test_emphasis_478():
     expected_tokens = [
         "[para(1,1):]",
         "[emphasis(1,1):1:*]",
-        "[text(1,2):foo :]",
-        "[text(1,6):_:]",
-        "[text(1,7):bar:]",
+        "[text(1,2):foo _bar:]",
         "[end-emphasis(1,10)::]",
-        "[text(1,11): baz:]",
-        "[text(1,15):_:]",
+        "[text(1,11): baz_:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p><em>foo _bar</em> baz_</p>"""
@@ -93,9 +90,7 @@ def test_emphasis_479():
         "[emphasis(1,1):1:*]",
         "[text(1,2):foo :]",
         "[emphasis(1,6):2:_]",
-        "[text(1,8):bar :]",
-        "[text(1,12):*:]",
-        "[text(1,13):baz bim:]",
+        "[text(1,8):bar *baz bim:]",
         "[end-emphasis(1,20)::]",
         "[text(1,22): bam:]",
         "[end-emphasis(1,26)::]",
@@ -117,8 +112,7 @@ def test_emphasis_480():
     source_markdown = """**foo **bar baz**"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):**:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):**foo :]",
         "[emphasis(1,7):2:*]",
         "[text(1,9):bar baz:]",
         "[end-emphasis(1,16)::]",
@@ -140,8 +134,7 @@ def test_emphasis_481():
     source_markdown = """*foo *bar baz*"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):*:]",
-        "[text(1,2):foo :]",
+        "[text(1,1):*foo :]",
         "[emphasis(1,6):1:*]",
         "[text(1,7):bar baz:]",
         "[end-emphasis(1,14)::]",
@@ -165,8 +158,7 @@ def test_emphasis_482():
         "[para(1,1):]",
         "[text(1,1):*:]",
         "[link(1,2):inline:/url:::::bar*:False::::]",
-        "[text(1,3):bar:]",
-        "[text(1,6):*:]",
+        "[text(1,3):bar*:]",
         "[end-link::]",
         "[end-para:::True]",
     ]
@@ -186,11 +178,9 @@ def test_emphasis_483():
     source_markdown = """_foo [bar_](/url)"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):_:]",
-        "[text(1,2):foo :]",
+        "[text(1,1):_foo :]",
         "[link(1,6):inline:/url:::::bar_:False::::]",
-        "[text(1,7):bar:]",
-        "[text(1,10):_:]",
+        "[text(1,7):bar_:]",
         "[end-link::]",
         "[end-para:::True]",
     ]
@@ -314,8 +304,7 @@ def test_emphasis_489():
     source_markdown = """**a<http://foo.bar/?q=**>"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):**:]",
-        "[text(1,3):a:]",
+        "[text(1,1):**a:]",
         "[uri-autolink(1,4):http://foo.bar/?q=**]",
         "[end-para:::True]",
     ]
@@ -337,8 +326,7 @@ def test_emphasis_490():
     source_markdown = """__a<http://foo.bar/?q=__>"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):__:]",
-        "[text(1,3):a:]",
+        "[text(1,1):__a:]",
         "[uri-autolink(1,4):http://foo.bar/?q=__]",
         "[end-para:::True]",
     ]
diff --git a/test/gfm/test_markdown_emphasis_rule_2.py b/test/gfm/test_markdown_emphasis_rule_2.py
index a0a255b4..eb6e5eca 100644
--- a/test/gfm/test_markdown_emphasis_rule_2.py
+++ b/test/gfm/test_markdown_emphasis_rule_2.py
@@ -36,13 +36,7 @@ def test_emphasis_367():
 
     # Arrange
     source_markdown = """_ foo bar_"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):_:]",
-        "[text(1,2): foo bar:]",
-        "[text(1,10):_:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):_ foo bar_:]", "[end-para:::True]"]
     expected_gfm = """<p>_ foo bar_</p>"""
 
     # Act & Assert
@@ -59,10 +53,7 @@ def test_emphasis_368():
     source_markdown = """a_"foo"_"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):_:]",
-        '[text(1,3):\a"\a&quot;\afoo\a"\a&quot;\a:]',
-        "[text(1,8):_:]",
+        '[text(1,1):a_\a"\a&quot;\afoo\a"\a&quot;\a_:]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a_&quot;foo&quot;_</p>"""
@@ -79,14 +70,7 @@ def test_emphasis_369():
 
     # Arrange
     source_markdown = """foo_bar_"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):foo:]",
-        "[text(1,4):_:]",
-        "[text(1,5):bar:]",
-        "[text(1,8):_:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):foo_bar_:]", "[end-para:::True]"]
     expected_gfm = """<p>foo_bar_</p>"""
 
     # Act & Assert
@@ -101,15 +85,7 @@ def test_emphasis_370():
 
     # Arrange
     source_markdown = """5_6_78"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):5:]",
-        "[text(1,2):_:]",
-        "[text(1,3):6:]",
-        "[text(1,4):_:]",
-        "[text(1,5):78:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):5_6_78:]", "[end-para:::True]"]
     expected_gfm = """<p>5_6_78</p>"""
 
     # Act & Assert
@@ -126,10 +102,7 @@ def test_emphasis_371():
     source_markdown = """пристаням_стремятся_"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):пристаням:]",
-        "[text(1,10):_:]",
-        "[text(1,11):стремятся:]",
-        "[text(1,20):_:]",
+        "[text(1,1):пристаням_стремятся_:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>пристаням_стремятся_</p>"""
@@ -148,11 +121,7 @@ def test_emphasis_372():
     source_markdown = """aa_"bb"_cc"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):aa:]",
-        "[text(1,3):_:]",
-        '[text(1,4):\a"\a&quot;\abb\a"\a&quot;\a:]',
-        "[text(1,8):_:]",
-        "[text(1,9):cc:]",
+        '[text(1,1):aa_\a"\a&quot;\abb\a"\a&quot;\a_cc:]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>aa_&quot;bb&quot;_cc</p>"""
diff --git a/test/gfm/test_markdown_emphasis_rule_3.py b/test/gfm/test_markdown_emphasis_rule_3.py
index 59f02ae3..1a417d70 100644
--- a/test/gfm/test_markdown_emphasis_rule_3.py
+++ b/test/gfm/test_markdown_emphasis_rule_3.py
@@ -15,13 +15,7 @@ def test_emphasis_374():
 
     # Arrange
     source_markdown = """_foo*"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):_:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):*:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):_foo*:]", "[end-para:::True]"]
     expected_gfm = """<p>_foo*</p>"""
 
     # Act & Assert
@@ -36,13 +30,7 @@ def test_emphasis_375():
 
     # Arrange
     source_markdown = """*foo bar *"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):*:]",
-        "[text(1,2):foo bar :]",
-        "[text(1,10):*:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):*foo bar *:]", "[end-para:::True]"]
     expected_gfm = """<p>*foo bar *</p>"""
 
     # Act & Assert
@@ -60,9 +48,7 @@ def test_emphasis_376():
 *"""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):*:]",
-        "[text(1,2):foo bar\n::\n]",
-        "[text(2,1):*:]",
+        "[text(1,1):*foo bar\n*::\n]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>*foo bar
@@ -80,14 +66,7 @@ def test_emphasis_377():
 
     # Arrange
     source_markdown = """*(*foo)"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):*:]",
-        "[text(1,2):(:]",
-        "[text(1,3):*:]",
-        "[text(1,4):foo):]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):*(*foo):]", "[end-para:::True]"]
     expected_gfm = """<p>*(*foo)</p>"""
 
     # Act & Assert
diff --git a/test/gfm/test_markdown_emphasis_rule_4.py b/test/gfm/test_markdown_emphasis_rule_4.py
index 3758d350..10cc897e 100644
--- a/test/gfm/test_markdown_emphasis_rule_4.py
+++ b/test/gfm/test_markdown_emphasis_rule_4.py
@@ -15,13 +15,7 @@ def test_emphasis_380():
 
     # Arrange
     source_markdown = """_foo bar _"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):_:]",
-        "[text(1,2):foo bar :]",
-        "[text(1,10):_:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):_foo bar _:]", "[end-para:::True]"]
     expected_gfm = """<p>_foo bar _</p>"""
 
     # Act & Assert
@@ -36,14 +30,7 @@ def test_emphasis_381():
 
     # Arrange
     source_markdown = """_(_foo)"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):_:]",
-        "[text(1,2):(:]",
-        "[text(1,3):_:]",
-        "[text(1,4):foo):]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):_(_foo):]", "[end-para:::True]"]
     expected_gfm = """<p>_(_foo)</p>"""
 
     # Act & Assert
@@ -83,14 +70,7 @@ def test_emphasis_383():
 
     # Arrange
     source_markdown = """_foo_bar"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):_:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):_:]",
-        "[text(1,6):bar:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):_foo_bar:]", "[end-para:::True]"]
     expected_gfm = """<p>_foo_bar</p>"""
 
     # Act & Assert
@@ -107,10 +87,7 @@ def test_emphasis_384():
     source_markdown = """_пристаням_стремятся"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):_:]",
-        "[text(1,2):пристаням:]",
-        "[text(1,11):_:]",
-        "[text(1,12):стремятся:]",
+        "[text(1,1):_пристаням_стремятся:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>_пристаням_стремятся</p>"""
@@ -130,11 +107,7 @@ def test_emphasis_385():
     expected_tokens = [
         "[para(1,1):]",
         "[emphasis(1,1):1:_]",
-        "[text(1,2):foo:]",
-        "[text(1,5):_:]",
-        "[text(1,6):bar:]",
-        "[text(1,9):_:]",
-        "[text(1,10):baz:]",
+        "[text(1,2):foo_bar_baz:]",
         "[end-emphasis(1,13)::]",
         "[end-para:::True]",
     ]
diff --git a/test/gfm/test_markdown_emphasis_rule_5.py b/test/gfm/test_markdown_emphasis_rule_5.py
index 7a9fdc01..ea47fbe2 100644
--- a/test/gfm/test_markdown_emphasis_rule_5.py
+++ b/test/gfm/test_markdown_emphasis_rule_5.py
@@ -36,13 +36,7 @@ def test_emphasis_388():
 
     # Arrange
     source_markdown = """** foo bar**"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):**:]",
-        "[text(1,3): foo bar:]",
-        "[text(1,11):**:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):** foo bar**:]", "[end-para:::True]"]
     expected_gfm = """<p>** foo bar**</p>"""
 
     # Act & Assert
@@ -59,10 +53,7 @@ def test_emphasis_389():
     source_markdown = """a**"foo"**"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):**:]",
-        '[text(1,4):\a"\a&quot;\afoo\a"\a&quot;\a:]',
-        "[text(1,9):**:]",
+        '[text(1,1):a**\a"\a&quot;\afoo\a"\a&quot;\a**:]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a**&quot;foo&quot;**</p>"""
diff --git a/test/gfm/test_markdown_emphasis_rule_6.py b/test/gfm/test_markdown_emphasis_rule_6.py
index 5b0dc170..ea469867 100644
--- a/test/gfm/test_markdown_emphasis_rule_6.py
+++ b/test/gfm/test_markdown_emphasis_rule_6.py
@@ -36,13 +36,7 @@ def test_emphasis_392():
 
     # Arrange
     source_markdown = """__ foo bar__"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):__:]",
-        "[text(1,3): foo bar:]",
-        "[text(1,11):__:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):__ foo bar__:]", "[end-para:::True]"]
     expected_gfm = """<p>__ foo bar__</p>"""
 
     # Act & Assert
@@ -60,9 +54,7 @@ def test_emphasis_393():
 foo bar__"""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):__:]",
-        "[text(1,3):\nfoo bar::\n]",
-        "[text(2,8):__:]",
+        "[text(1,1):__\nfoo bar__::\n]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>__
@@ -82,10 +74,7 @@ def test_emphasis_394():
     source_markdown = """a__"foo"__"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):__:]",
-        '[text(1,4):\a"\a&quot;\afoo\a"\a&quot;\a:]',
-        "[text(1,9):__:]",
+        '[text(1,1):a__\a"\a&quot;\afoo\a"\a&quot;\a__:]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a__&quot;foo&quot;__</p>"""
@@ -102,14 +91,7 @@ def test_emphasis_395():
 
     # Arrange
     source_markdown = """foo__bar__"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):foo:]",
-        "[text(1,4):__:]",
-        "[text(1,6):bar:]",
-        "[text(1,9):__:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):foo__bar__:]", "[end-para:::True]"]
     expected_gfm = """<p>foo__bar__</p>"""
 
     # Act & Assert
@@ -124,15 +106,7 @@ def test_emphasis_396():
 
     # Arrange
     source_markdown = """5__6__78"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):5:]",
-        "[text(1,2):__:]",
-        "[text(1,4):6:]",
-        "[text(1,5):__:]",
-        "[text(1,7):78:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):5__6__78:]", "[end-para:::True]"]
     expected_gfm = """<p>5__6__78</p>"""
 
     # Act & Assert
@@ -149,10 +123,7 @@ def test_emphasis_397():
     source_markdown = """пристаням__стремятся__"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):пристаням:]",
-        "[text(1,10):__:]",
-        "[text(1,12):стремятся:]",
-        "[text(1,21):__:]",
+        "[text(1,1):пристаням__стремятся__:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>пристаням__стремятся__</p>"""
diff --git a/test/gfm/test_markdown_emphasis_rule_7.py b/test/gfm/test_markdown_emphasis_rule_7.py
index b99e1545..17fc8260 100644
--- a/test/gfm/test_markdown_emphasis_rule_7.py
+++ b/test/gfm/test_markdown_emphasis_rule_7.py
@@ -15,13 +15,7 @@ def test_emphasis_400():
 
     # Arrange
     source_markdown = """**foo bar **"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):**:]",
-        "[text(1,3):foo bar :]",
-        "[text(1,11):**:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):**foo bar **:]", "[end-para:::True]"]
     expected_gfm = """<p>**foo bar **</p>"""
 
     # Act & Assert
@@ -36,14 +30,7 @@ def test_emphasis_401():
 
     # Arrange
     source_markdown = """**(**foo)"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):**:]",
-        "[text(1,3):(:]",
-        "[text(1,4):**:]",
-        "[text(1,6):foo):]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):**(**foo):]", "[end-para:::True]"]
     expected_gfm = """<p>**(**foo)</p>"""
 
     # Act & Assert
diff --git a/test/gfm/test_markdown_emphasis_rule_8.py b/test/gfm/test_markdown_emphasis_rule_8.py
index 0a0103fe..0b46c21f 100644
--- a/test/gfm/test_markdown_emphasis_rule_8.py
+++ b/test/gfm/test_markdown_emphasis_rule_8.py
@@ -15,13 +15,7 @@ def test_emphasis_406():
 
     # Arrange
     source_markdown = """__foo bar __"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):__:]",
-        "[text(1,3):foo bar :]",
-        "[text(1,11):__:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):__foo bar __:]", "[end-para:::True]"]
     expected_gfm = """<p>__foo bar __</p>"""
 
     # Act & Assert
@@ -36,14 +30,7 @@ def test_emphasis_407():
 
     # Arrange
     source_markdown = """__(__foo)"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):__:]",
-        "[text(1,3):(:]",
-        "[text(1,4):__:]",
-        "[text(1,6):foo):]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):__(__foo):]", "[end-para:::True]"]
     expected_gfm = """<p>__(__foo)</p>"""
 
     # Act & Assert
@@ -83,14 +70,7 @@ def test_emphasis_409():
 
     # Arrange
     source_markdown = """__foo__bar"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):__:]",
-        "[text(1,3):foo:]",
-        "[text(1,6):__:]",
-        "[text(1,8):bar:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):__foo__bar:]", "[end-para:::True]"]
     expected_gfm = """<p>__foo__bar</p>"""
 
     # Act & Assert
@@ -107,10 +87,7 @@ def test_emphasis_410():
     source_markdown = """__пристаням__стремятся"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):__:]",
-        "[text(1,3):пристаням:]",
-        "[text(1,12):__:]",
-        "[text(1,14):стремятся:]",
+        "[text(1,1):__пристаням__стремятся:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>__пристаням__стремятся</p>"""
@@ -130,11 +107,7 @@ def test_emphasis_411():
     expected_tokens = [
         "[para(1,1):]",
         "[emphasis(1,1):2:_]",
-        "[text(1,3):foo:]",
-        "[text(1,6):__:]",
-        "[text(1,8):bar:]",
-        "[text(1,11):__:]",
-        "[text(1,13):baz:]",
+        "[text(1,3):foo__bar__baz:]",
         "[end-emphasis(1,16)::]",
         "[end-para:::True]",
     ]
diff --git a/test/gfm/test_markdown_emphasis_rule_9.py b/test/gfm/test_markdown_emphasis_rule_9.py
index 77d00086..17018b58 100644
--- a/test/gfm/test_markdown_emphasis_rule_9.py
+++ b/test/gfm/test_markdown_emphasis_rule_9.py
@@ -213,9 +213,7 @@ def test_emphasis_421():
     expected_tokens = [
         "[para(1,1):]",
         "[emphasis(1,1):1:*]",
-        "[text(1,2):foo:]",
-        "[text(1,5):**:]",
-        "[text(1,7):bar:]",
+        "[text(1,2):foo**bar:]",
         "[end-emphasis(1,10)::]",
         "[end-para:::True]",
     ]
@@ -340,8 +338,7 @@ def test_emphasis_426():
         "[end-emphasis(1,13)::]",
         "[end-emphasis(1,15)::]",
         "[end-emphasis(1,17)::]",
-        "[text(1,19):***:]",
-        "[text(1,22):baz:]",
+        "[text(1,19):***baz:]",
         "[end-para:::True]",
     ]
     expected_gfm = (
@@ -417,8 +414,7 @@ def test_emphasis_429():
     source_markdown = """** is not an empty emphasis"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):**:]",
-        "[text(1,3): is not an empty emphasis:]",
+        "[text(1,1):** is not an empty emphasis:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>** is not an empty emphasis</p>"""
@@ -437,8 +433,7 @@ def test_emphasis_430():
     source_markdown = """**** is not an empty strong emphasis"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):****:]",
-        "[text(1,5): is not an empty strong emphasis:]",
+        "[text(1,1):**** is not an empty strong emphasis:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>**** is not an empty strong emphasis</p>"""
diff --git a/test/gfm/test_markdown_entity_and_numeric_character_references.py b/test/gfm/test_markdown_entity_and_numeric_character_references.py
index d284ad57..5ef52f62 100644
--- a/test/gfm/test_markdown_entity_and_numeric_character_references.py
+++ b/test/gfm/test_markdown_entity_and_numeric_character_references.py
@@ -622,10 +622,7 @@ def test_character_references_337():
     source_markdown = """[a](url &quot;tit&quot;)"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):a:]",
-        "[text(1,3):]:]",
-        '[text(1,4):(url \a&quot;\a\a"\a&quot;\a\atit\a&quot;\a\a"\a&quot;\a\a):]',
+        '[text(1,1):[a](url \a&quot;\a\a"\a&quot;\a\atit\a&quot;\a\a"\a&quot;\a\a):]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[a](url &quot;tit&quot;)</p>"""
diff --git a/test/gfm/test_markdown_fenced_code_blocks.py b/test/gfm/test_markdown_fenced_code_blocks.py
index 00de3c94..0d199e09 100644
--- a/test/gfm/test_markdown_fenced_code_blocks.py
+++ b/test/gfm/test_markdown_fenced_code_blocks.py
@@ -1519,10 +1519,7 @@ def test_fenced_code_blocks_extra_02a():
         "[end-fcode-block::::True]",
         "[li(2,1):2::]",
         "[para(2,3):\n]",
-        "[text(2,3):[:]",
-        "[text(2,4):foo:]",
-        "[text(2,7):]:]",
-        "[text(2,8)::\n/url::\n]",
+        "[text(2,3):[foo]:\n/url::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[fcode-block(4,1):`:3::::::]",
diff --git a/test/gfm/test_markdown_html_blocks.py b/test/gfm/test_markdown_html_blocks.py
index b25aa820..81847bec 100644
--- a/test/gfm/test_markdown_html_blocks.py
+++ b/test/gfm/test_markdown_html_blocks.py
@@ -1925,10 +1925,7 @@ def test_html_blocks_extra_02a():
         "[end-html-block:::True]",
         "[li(2,1):2::]",
         "[para(2,3):\n\n]",
-        "[text(2,3):[:]",
-        "[text(2,4):foo:]",
-        "[text(2,7):]:]",
-        "[text(2,8)::\n/url\n::\n\n]",
+        "[text(2,3):[foo]:\n/url\n::\n\n]",
         "[raw-html(4,1):/script]",
         "[end-para:::True]",
         "[BLANK(5,1):]",
@@ -1971,10 +1968,7 @@ def test_html_blocks_extra_02b():
         "[end-html-block:::True]",
         "[li(2,1):2::]",
         "[para(2,3):\n \n ]",
-        "[text(2,3):[:]",
-        "[text(2,4):foo:]",
-        "[text(2,7):]:]",
-        "[text(2,8)::\n/url\nscript::\n\n]",
+        "[text(2,3):[foo]:\n/url\nscript::\n\n]",
         "[end-para:::True]",
         "[BLANK(5,1):]",
         "[end-ulist:::True]",
@@ -2016,10 +2010,7 @@ script
         "[end-html-block:::True]",
         "[li(2,1):2::]",
         "[para(2,3):\n\n]",
-        "[text(2,3):[:]",
-        "[text(2,4):foo:]",
-        "[text(2,7):]:]",
-        "[text(2,8)::\n/url\nscript::\n\n]",
+        "[text(2,3):[foo]:\n/url\nscript::\n\n]",
         "[end-para:::True]",
         "[BLANK(5,1):]",
         "[end-ulist:::True]",
diff --git a/test/gfm/test_markdown_image_links.py b/test/gfm/test_markdown_image_links.py
index 73140dd1..61ea3a66 100644
--- a/test/gfm/test_markdown_image_links.py
+++ b/test/gfm/test_markdown_image_links.py
@@ -516,9 +516,7 @@ def test_image_link_595():
     expected_tokens = [
         "[para(1,1):\n]",
         "[image(1,1):shortcut:/url:title:foo::::foo:False::::]",
-        "[text(1,7):\n:: \n]",
-        "[text(2,1):[:]",
-        "[text(2,2):]:]",
+        "[text(1,7):\n[]:: \n]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         '[link-ref-def(4,1):True::foo:: :/url:: :title:"title":]',
@@ -594,20 +592,11 @@ def test_image_link_598():
 """
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):![:]",
-        "[text(1,3):[:]",
-        "[text(1,4):foo:]",
-        "[text(1,7):]:]",
-        "[text(1,8):]:]",
+        "[text(1,1):![[foo]]:]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):[:]",
-        "[text(3,3):foo:]",
-        "[text(3,6):]:]",
-        "[text(3,7):]:]",
-        '[text(3,8):: /url \a"\a&quot;\atitle\a"\a&quot;\a:]',
+        '[text(3,1):[[foo]]: /url \a"\a&quot;\atitle\a"\a&quot;\a:]',
         "[end-para:::True]",
         "[BLANK(4,1):]",
     ]
@@ -656,8 +645,7 @@ def test_image_link_600():
 """
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):!\\\b[foo:]",
-        "[text(1,7):]:]",
+        "[text(1,1):!\\\b[foo]:]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         '[link-ref-def(3,1):True::foo:: :/url:: :title:"title":]',
diff --git a/test/gfm/test_markdown_inline_links.py b/test/gfm/test_markdown_inline_links.py
index 84d0aab5..922dafd1 100644
--- a/test/gfm/test_markdown_inline_links.py
+++ b/test/gfm/test_markdown_inline_links.py
@@ -147,10 +147,7 @@ def test_inline_links_497():
     source_markdown = """[link](/my uri)"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):link:]",
-        "[text(1,6):]:]",
-        "[text(1,7):(/my uri):]",
+        "[text(1,1):[link](/my uri):]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[link](/my uri)</p>"""
@@ -218,10 +215,7 @@ def test_inline_links_499():
 bar)"""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):[:]",
-        "[text(1,2):link:]",
-        "[text(1,6):]:]",
-        "[text(1,7):(foo\nbar)::\n]",
+        "[text(1,1):[link](foo\nbar)::\n]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[link](foo
@@ -242,10 +236,7 @@ def test_inline_links_500():
 bar>)"""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):[:]",
-        "[text(1,2):link:]",
-        "[text(1,6):]:]",
-        "[text(1,7):(:]",
+        "[text(1,1):[link](:]",
         "[raw-html(1,8):foo\nbar]",
         "[text(2,5):):]",
         "[end-para:::True]",
@@ -288,10 +279,7 @@ def test_inline_links_502():
     source_markdown = """[link](<foo\\>)"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):link:]",
-        "[text(1,6):]:]",
-        "[text(1,7):(\a<\a&lt;\afoo\\\b\a>\a&gt;\a):]",
+        "[text(1,1):[link](\a<\a&lt;\afoo\\\b\a>\a&gt;\a):]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[link](&lt;foo&gt;)</p>"""
@@ -312,18 +300,7 @@ def test_inline_links_503():
 [a](<b>c)"""
     expected_tokens = [
         "[para(1,1):\n\n]",
-        "[text(1,1):[:]",
-        "[text(1,2):a:]",
-        "[text(1,3):]:]",
-        "[text(1,4):(\a<\a&lt;\ab)c\n::\n]",
-        "[text(2,1):[:]",
-        "[text(2,2):a:]",
-        "[text(2,3):]:]",
-        "[text(2,4):(\a<\a&lt;\ab)c\a>\a&gt;\a\n::\n]",
-        "[text(3,1):[:]",
-        "[text(3,2):a:]",
-        "[text(3,3):]:]",
-        "[text(3,4):(:]",
+        "[text(1,1):[a](\a<\a&lt;\ab)c\n[a](\a<\a&lt;\ab)c\a>\a&gt;\a\n[a](::\n\n]",
         "[raw-html(3,5):b]",
         "[text(3,8):c):]",
         "[end-para:::True]",
@@ -430,10 +407,7 @@ def test_inline_links_507b():
     source_markdown = """[link](foo(and(bar))"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):link:]",
-        "[text(1,6):]:]",
-        "[text(1,7):(foo(and(bar)):]",
+        "[text(1,1):[link](foo(and(bar)):]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[link](foo(and(bar))</p>"""
@@ -452,10 +426,7 @@ def test_inline_links_507c():
     source_markdown = """[link](foo(and(b(ar))"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):link:]",
-        "[text(1,6):]:]",
-        "[text(1,7):(foo(and(b(ar)):]",
+        "[text(1,1):[link](foo(and(b(ar)):]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[link](foo(and(b(ar))</p>"""
@@ -675,10 +646,7 @@ def test_inline_links_515b():
     source_markdown = """[link](/url "title)"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):link:]",
-        "[text(1,6):]:]",
-        '[text(1,7):(/url \a"\a&quot;\atitle):]',
+        '[text(1,1):[link](/url \a"\a&quot;\atitle):]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[link](/url &quot;title)</p>"""
@@ -718,10 +686,7 @@ def test_inline_links_515d():
     source_markdown = """[link](/url (title)"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):link:]",
-        "[text(1,6):]:]",
-        "[text(1,7):(/url (title):]",
+        "[text(1,1):[link](/url (title):]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[link](/url (title)</p>"""
@@ -783,10 +748,7 @@ def test_inline_links_515g():
     source_markdown = """[link](/url (title(otherline) abc"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):link:]",
-        "[text(1,6):]:]",
-        "[text(1,7):(/url (title(otherline) abc:]",
+        "[text(1,1):[link](/url (title(otherline) abc:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[link](/url (title(otherline) abc</p>"""
@@ -805,10 +767,7 @@ def test_inline_links_516():
     source_markdown = """[link](/url "title "and" title")"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):link:]",
-        "[text(1,6):]:]",
-        '[text(1,7):(/url \a"\a&quot;\atitle \a"\a&quot;\aand\a"\a&quot;\a title\a"\a&quot;\a):]',
+        '[text(1,1):[link](/url \a"\a&quot;\atitle \a"\a&quot;\aand\a"\a&quot;\a title\a"\a&quot;\a):]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[link](/url &quot;title &quot;and&quot; title&quot;)</p>"""
@@ -872,10 +831,7 @@ def test_inline_links_519():
     source_markdown = """[link] (/uri)"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):link:]",
-        "[text(1,6):]:]",
-        "[text(1,7): (/uri):]",
+        "[text(1,1):[link] (/uri):]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[link] (/uri)</p>"""
@@ -896,13 +852,7 @@ def test_inline_links_520():
     expected_tokens = [
         "[para(1,1):]",
         "[link(1,1):inline:/uri:::::link [foo [bar]]:False::::]",
-        "[text(1,2):link :]",
-        "[text(1,7):[:]",
-        "[text(1,8):foo :]",
-        "[text(1,12):[:]",
-        "[text(1,13):bar:]",
-        "[text(1,16):]:]",
-        "[text(1,17):]:]",
+        "[text(1,2):link [foo [bar]]:]",
         "[end-link::]",
         "[end-para:::True]",
     ]
@@ -923,12 +873,7 @@ def test_inline_links_521():
     source_markdown = """[link] bar](/uri)"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):link:]",
-        "[text(1,6):]:]",
-        "[text(1,7): bar:]",
-        "[text(1,11):]:]",
-        "[text(1,12):(/uri):]",
+        "[text(1,1):[link] bar](/uri):]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[link] bar](/uri)</p>"""
@@ -948,8 +893,7 @@ def test_inline_links_522():
     source_markdown = """[link [bar](/uri)"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):link :]",
+        "[text(1,1):[link :]",
         "[link(1,7):inline:/uri:::::bar:False::::]",
         "[text(1,8):bar:]",
         "[end-link::]",
@@ -1043,13 +987,11 @@ def test_inline_links_526():
     source_markdown = """[foo [bar](/uri)](/uri)"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo :]",
+        "[text(1,1):[foo :]",
         "[link(1,6):inline:/uri:::::bar:False::::]",
         "[text(1,7):bar:]",
         "[end-link::]",
-        "[text(1,17):]:]",
-        "[text(1,18):(/uri):]",
+        "[text(1,17):](/uri):]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[foo <a href="/uri">bar</a>](/uri)</p>"""
@@ -1068,13 +1010,11 @@ def test_inline_links_526a():
     source_markdown = """[foo [bar](/uri1)](/uri2)"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo :]",
+        "[text(1,1):[foo :]",
         "[link(1,6):inline:/uri1:::::bar:False::::]",
         "[text(1,7):bar:]",
         "[end-link::]",
-        "[text(1,18):]:]",
-        "[text(1,19):(/uri2):]",
+        "[text(1,18):](/uri2):]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[foo <a href="/uri1">bar</a>](/uri2)</p>"""
@@ -1093,19 +1033,15 @@ def test_inline_links_527():
     source_markdown = """[foo *[bar [baz](/uri)](/uri)*](/uri)"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo :]",
+        "[text(1,1):[foo :]",
         "[emphasis(1,6):1:*]",
-        "[text(1,7):[:]",
-        "[text(1,8):bar :]",
+        "[text(1,7):[bar :]",
         "[link(1,12):inline:/uri:::::baz:False::::]",
         "[text(1,13):baz:]",
         "[end-link::]",
-        "[text(1,23):]:]",
-        "[text(1,24):(/uri):]",
+        "[text(1,23):](/uri):]",
         "[end-emphasis(1,30)::]",
-        "[text(1,31):]:]",
-        "[text(1,32):(/uri):]",
+        "[text(1,31):](/uri):]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[foo <em>[bar <a href="/uri">baz</a>](/uri)</em>](/uri)</p>"""
@@ -1124,19 +1060,15 @@ def test_inline_links_527a():
     source_markdown = """[foo *[bar [baz](/uri1)](/uri2)*](/uri3)"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo :]",
+        "[text(1,1):[foo :]",
         "[emphasis(1,6):1:*]",
-        "[text(1,7):[:]",
-        "[text(1,8):bar :]",
+        "[text(1,7):[bar :]",
         "[link(1,12):inline:/uri1:::::baz:False::::]",
         "[text(1,13):baz:]",
         "[end-link::]",
-        "[text(1,24):]:]",
-        "[text(1,25):(/uri2):]",
+        "[text(1,24):](/uri2):]",
         "[end-emphasis(1,32)::]",
-        "[text(1,33):]:]",
-        "[text(1,34):(/uri3):]",
+        "[text(1,33):](/uri3):]",
         "[end-para:::True]",
     ]
     expected_gfm = (
@@ -1235,8 +1167,7 @@ def test_inline_links_529():
         "[para(1,1):]",
         "[text(1,1):*:]",
         "[link(1,2):inline:/uri:::::foo*:False::::]",
-        "[text(1,3):foo:]",
-        "[text(1,6):*:]",
+        "[text(1,3):foo*:]",
         "[end-link::]",
         "[end-para:::True]",
     ]
@@ -1257,9 +1188,7 @@ def test_inline_links_530():
     expected_tokens = [
         "[para(1,1):]",
         "[link(1,1):inline:baz*:::::foo *bar:False::::]",
-        "[text(1,2):foo :]",
-        "[text(1,6):*:]",
-        "[text(1,7):bar:]",
+        "[text(1,2):foo *bar:]",
         "[end-link::]",
         "[end-para:::True]",
     ]
@@ -1280,12 +1209,9 @@ def test_inline_links_531():
     expected_tokens = [
         "[para(1,1):]",
         "[emphasis(1,1):1:*]",
-        "[text(1,2):foo :]",
-        "[text(1,6):[:]",
-        "[text(1,7):bar:]",
+        "[text(1,2):foo [bar:]",
         "[end-emphasis(1,10)::]",
-        "[text(1,11): baz:]",
-        "[text(1,15):]:]",
+        "[text(1,11): baz]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p><em>foo [bar</em> baz]</p>"""
@@ -1305,8 +1231,7 @@ def test_inline_links_532():
     source_markdown = """[foo <bar attr="](baz)">"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo :]",
+        "[text(1,1):[foo :]",
         '[raw-html(1,6):bar attr="](baz)"]',
         "[end-para:::True]",
     ]
@@ -1327,8 +1252,7 @@ def test_inline_links_533():
     source_markdown = """[foo`](/uri)`"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
+        "[text(1,1):[foo:]",
         "[icode-span(1,5):](/uri):`::]",
         "[end-para:::True]",
     ]
@@ -1349,8 +1273,7 @@ def test_inline_links_534():
     source_markdown = """[foo<http://example.com/?search=](uri)>"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
+        "[text(1,1):[foo:]",
         "[uri-autolink(1,5):http://example.com/?search=](uri)]",
         "[end-para:::True]",
     ]
diff --git a/test/gfm/test_markdown_link_reference_definitions.py b/test/gfm/test_markdown_link_reference_definitions.py
index 019014ae..09269ff1 100644
--- a/test/gfm/test_markdown_link_reference_definitions.py
+++ b/test/gfm/test_markdown_link_reference_definitions.py
@@ -76,9 +76,7 @@ def test_link_reference_definitions_163():
         "[BLANK(2,1):]",
         "[para(3,1):]",
         "[link(3,1):shortcut:my_(url):title (with parens)::::Foo*bar\\]:False::::]",
-        "[text(3,2):Foo:]",
-        "[text(3,5):*:]",
-        "[text(3,6):bar\\\b]:]",
+        "[text(3,2):Foo*bar\\\b]:]",
         "[end-link::]",
         "[end-para:::True]",
     ]
@@ -164,24 +162,19 @@ bar]: /url 'title'
 [foo\n\nbar]"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
+        "[text(1,1):[foo:]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):bar:]",
-        "[text(3,4):]:]",
-        "[text(3,5):: /url 'title':]",
+        "[text(3,1):bar]: /url 'title':]",
         "[end-para:::True]",
         "[BLANK(4,1):]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):foo:]",
+        "[text(5,1):[foo:]",
         "[end-para:::True]",
         "[BLANK(6,1):]",
         "[para(7,1):]",
-        "[text(7,1):bar:]",
-        "[text(7,4):]:]",
+        "[text(7,1):bar]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[foo</p>
@@ -207,10 +200,7 @@ with blank line'
 [foo]"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):]:]",
-        "[text(1,6):: /url 'title:]",
+        "[text(1,1):[foo]: /url 'title:]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
@@ -218,9 +208,7 @@ with blank line'
         "[end-para:::True]",
         "[BLANK(4,1):]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):foo:]",
-        "[text(5,5):]:]",
+        "[text(5,1):[foo]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[foo]: /url 'title</p>
@@ -245,16 +233,11 @@ with blank line
 [foo]"""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):]:]",
-        "[text(1,6):: /url 'title\nwith blank line::\n]",
+        "[text(1,1):[foo]: /url 'title\nwith blank line::\n]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[para(4,1):]",
-        "[text(4,1):[:]",
-        "[text(4,2):foo:]",
-        "[text(4,5):]:]",
+        "[text(4,1):[foo]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[foo]: /url 'title\nwith blank line</p>\n<p>[foo]</p>"""
@@ -331,16 +314,11 @@ def test_link_reference_definitions_168():
 [foo]"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):]:]",
-        "[text(1,6):::]",
+        "[text(1,1):[foo]::]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):foo:]",
-        "[text(3,5):]:]",
+        "[text(3,1):[foo]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[foo]:</p>
@@ -387,18 +365,13 @@ def test_link_reference_definitions_170():
 [foo]"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):]:]",
-        "[text(1,6):: :]",
+        "[text(1,1):[foo]: :]",
         "[raw-html(1,8):bar]",
         "[text(1,13):(baz):]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):foo:]",
-        "[text(3,5):]:]",
+        "[text(3,1):[foo]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[foo]: <bar>(baz)</p>
@@ -587,10 +560,7 @@ def test_link_reference_definitions_178():
     source_markdown = """[foo]: /url "title" ok"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):]:]",
-        '[text(1,6):: /url \a"\a&quot;\atitle\a"\a&quot;\a ok:]',
+        '[text(1,1):[foo]: /url \a"\a&quot;\atitle\a"\a&quot;\a ok:]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[foo]: /url &quot;title&quot; ok</p>"""
@@ -636,9 +606,7 @@ def test_link_reference_definitions_180():
         "[end-icode-block:::False]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):foo:]",
-        "[text(3,5):]:]",
+        "[text(3,1):[foo]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<pre><code>[foo]: /url &quot;title&quot;
@@ -667,9 +635,7 @@ def test_link_reference_definitions_181():
         "[end-fcode-block:::3:False]",
         "[BLANK(4,1):]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):foo:]",
-        "[text(5,5):]:]",
+        "[text(5,1):[foo]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<pre><code>[foo]: /url
@@ -693,17 +659,11 @@ def test_link_reference_definitions_182():
 [bar]"""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):Foo\n::\n]",
-        "[text(2,1):[:]",
-        "[text(2,2):bar:]",
-        "[text(2,5):]:]",
-        "[text(2,6):: /baz:]",
+        "[text(1,1):Foo\n[bar]: /baz::\n]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[para(4,1):]",
-        "[text(4,1):[:]",
-        "[text(4,2):bar:]",
-        "[text(4,5):]:]",
+        "[text(4,1):[bar]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>Foo
@@ -929,14 +889,7 @@ def test_link_reference_definitions_183f():
     expected_tokens = [
         "[block-quote(1,1)::> \n\n> ]",
         "[para(1,3):\n\n]",
-        "[text(1,3):A simple block quote\n::\n]",
-        "[text(2,1):[:]",
-        "[text(2,2):foo:]",
-        "[text(2,5):]:]",
-        "[text(2,6):: /url\n::\n]",
-        "[text(3,3):[:]",
-        "[text(3,4):Foo:]",
-        "[text(3,7):]:]",
+        "[text(1,3):A simple block quote\n[foo]: /url\n[Foo]::\n\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -963,18 +916,12 @@ def test_link_reference_definitions_183gx():
     expected_tokens = [
         "[ulist(1,1):-::2::]",
         "[para(1,3):\n]",
-        "[text(1,3):A simple list\n::\n]",
-        "[text(2,1):[:]",
-        "[text(2,2):foo:]",
-        "[text(2,5):]:]",
-        "[text(2,6):: /url:]",
+        "[text(1,3):A simple list\n[foo]: /url::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[block-quote(3,1)::> ]",
         "[para(3,3):]",
-        "[text(3,3):[:]",
-        "[text(3,4):Foo:]",
-        "[text(3,7):]:]",
+        "[text(3,3):[Foo]:]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -1003,16 +950,12 @@ foo]: /url
     expected_tokens = [
         "[ulist(1,1):-::2::]",
         "[para(1,3):\n]",
-        "[text(1,3):A simple list\nfoo::\n]",
-        "[text(2,4):]:]",
-        "[text(2,5):: /url:]",
+        "[text(1,3):A simple list\nfoo]: /url::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[block-quote(3,1)::> ]",
         "[para(3,3):]",
-        "[text(3,3):[:]",
-        "[text(3,4):Foo:]",
-        "[text(3,7):]:]",
+        "[text(3,3):[Foo]:]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -1041,18 +984,12 @@ def test_link_reference_definitions_183gb():
     expected_tokens = [
         "[ulist(1,1):-::2::]",
         "[para(1,3):\n ]",
-        "[text(1,3):A simple list\n::\n]",
-        "[text(2,2):[:]",
-        "[text(2,3):foo:]",
-        "[text(2,6):]:]",
-        "[text(2,7):: /url:]",
+        "[text(1,3):A simple list\n[foo]: /url::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[block-quote(3,1)::> ]",
         "[para(3,3):]",
-        "[text(3,3):[:]",
-        "[text(3,4):Foo:]",
-        "[text(3,7):]:]",
+        "[text(3,3):[Foo]:]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -1082,18 +1019,12 @@ def test_link_reference_definitions_183gc():
     expected_tokens = [
         "[olist(1,1):.:1:3::]",
         "[para(1,4):\n ]",
-        "[text(1,4):A simple list\n::\n]",
-        "[text(2,2):[:]",
-        "[text(2,3):foo:]",
-        "[text(2,6):]:]",
-        "[text(2,7):: /url:]",
+        "[text(1,4):A simple list\n[foo]: /url::\n]",
         "[end-para:::True]",
         "[end-olist:::True]",
         "[block-quote(3,1)::> ]",
         "[para(3,3):]",
-        "[text(3,3):[:]",
-        "[text(3,4):Foo:]",
-        "[text(3,7):]:]",
+        "[text(3,3):[Foo]:]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -1122,18 +1053,12 @@ def test_link_reference_definitions_183gd():
     expected_tokens = [
         "[ulist(1,1):-::2::  ]",
         "[para(1,3):\n  ]",
-        "[text(1,3):A simple list\n::\n]",
-        "[text(2,3):[:]",
-        "[text(2,4):foo:]",
-        "[text(2,7):]:]",
-        "[text(2,8):: /url:]",
+        "[text(1,3):A simple list\n[foo]: /url::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[block-quote(3,1)::> ]",
         "[para(3,3):]",
-        "[text(3,3):[:]",
-        "[text(3,4):Foo:]",
-        "[text(3,7):]:]",
+        "[text(3,3):[Foo]:]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -1171,9 +1096,7 @@ def test_link_reference_definitions_183ge():
         "[end-ulist:::True]",
         "[block-quote(3,1)::> ]",
         "[para(3,3):]",
-        "[text(3,3):[:]",
-        "[text(3,4):Foo:]",
-        "[text(3,7):]:]",
+        "[text(3,3):[Foo]:]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -1207,9 +1130,7 @@ items
         "[end-ulist:::True]",
         "[block-quote(3,1)::> ]",
         "[para(3,3):]",
-        "[text(3,3):[:]",
-        "[text(3,4):Foo:]",
-        "[text(3,7):]:]",
+        "[text(3,3):[Foo]:]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -1238,17 +1159,11 @@ def test_link_reference_definitions_183gg():
     expected_tokens = [
         "[ulist(1,1):-::2::\n]",
         "[para(1,3):\n]",
-        "[text(1,3):A simple list\n::\n]",
-        "[text(2,1):[:]",
-        "[text(2,2):foo:]",
-        "[text(2,5):]:]",
-        "[text(2,6):: /url:]",
+        "[text(1,3):A simple list\n[foo]: /url::\n]",
         "[end-para:::True]",
         "[block-quote(3,3):  :  > ]",
         "[para(3,5):]",
-        "[text(3,5):[:]",
-        "[text(3,6):Foo:]",
-        "[text(3,9):]:]",
+        "[text(3,5):[Foo]:]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-ulist:::True]",
@@ -1645,12 +1560,7 @@ def test_link_reference_definitions_188b():
 
     # Arrange
     source_markdown = """[foo"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):[foo:]", "[end-para:::True]"]
     expected_gfm = """<p>[foo</p>"""
 
     # Act & Assert
@@ -1665,13 +1575,7 @@ def test_link_reference_definitions_188c():
 
     # Arrange
     source_markdown = """[foo]"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):]:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):[foo]:]", "[end-para:::True]"]
     expected_gfm = """<p>[foo]</p>"""
 
     # Act & Assert
@@ -1686,14 +1590,7 @@ def test_link_reference_definitions_188d():
 
     # Arrange
     source_markdown = """[foo]:"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):]:]",
-        "[text(1,6):::]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):[foo]::]", "[end-para:::True]"]
     expected_gfm = """<p>[foo]:</p>"""
 
     # Act & Assert
@@ -1710,10 +1607,7 @@ def test_link_reference_definitions_188e():
     source_markdown = """[foo]: /url ("""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):]:]",
-        "[text(1,6):: /url (:]",
+        "[text(1,1):[foo]: /url (:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[foo]: /url (</p>"""
@@ -1738,10 +1632,7 @@ def test_link_reference_definitions_extra_01():
     expected_tokens = [
         "[ulist(1,1):-::2::]",
         "[para(1,3):\n]",
-        "[text(1,3):[:]",
-        "[text(1,4):foo:]",
-        "[text(1,7):]:]",
-        "[text(1,8)::\n/url::\n]",
+        "[text(1,3):[foo]:\n/url::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
     ]
@@ -1792,10 +1683,7 @@ def test_link_reference_definitions_extra_01b():
     expected_tokens = [
         "[ulist(1,1):-::2::]",
         "[para(1,3):\n ]",
-        "[text(1,3):[:]",
-        "[text(1,4):foo:]",
-        "[text(1,7):]:]",
-        "[text(1,8)::\n/url::\n]",
+        "[text(1,3):[foo]:\n/url::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
     ]
@@ -1820,10 +1708,7 @@ def test_link_reference_definitions_extra_01c():
     expected_tokens = [
         "[ulist(1,1):-::2:]",
         "[para(1,3):]",
-        "[text(1,3):[:]",
-        "[text(1,4):foo:]",
-        "[text(1,7):]:]",
-        "[text(1,8):::]",
+        "[text(1,3):[foo]::]",
         "[end-para:::True]",
         "[li(2,1):2::]",
         "[para(2,3):]",
@@ -1852,10 +1737,7 @@ def test_link_reference_definitions_extra_01d():
     expected_tokens = [
         "[olist(1,1):.:1:3:]",
         "[para(1,4):]",
-        "[text(1,4):[:]",
-        "[text(1,5):foo:]",
-        "[text(1,8):]:]",
-        "[text(1,9):::]",
+        "[text(1,4):[foo]::]",
         "[end-para:::True]",
         "[li(2,1):3::1]",
         "[para(2,4):]",
@@ -1884,10 +1766,7 @@ def test_link_reference_definitions_extra_02x():
     expected_tokens = [
         "[block-quote(1,1)::> \n]",
         "[para(1,3):\n]",
-        "[text(1,3):[:]",
-        "[text(1,4):foo:]",
-        "[text(1,7):]:]",
-        "[text(1,8)::\n/url::\n]",
+        "[text(1,3):[foo]:\n/url::\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -1933,10 +1812,7 @@ def test_link_reference_definitions_extra_02bx():
     expected_tokens = [
         "[block-quote(1,1)::> ]",
         "[para(1,3):]",
-        "[text(1,3):[:]",
-        "[text(1,4):foo:]",
-        "[text(1,7):]:]",
-        "[text(1,8):::]",
+        "[text(1,3):[foo]::]",
         "[end-para:::True]",
         "[block-quote(2,1)::>> ]",
         "[para(2,4):]",
@@ -1968,10 +1844,7 @@ def test_link_reference_definitions_extra_02ba():
     expected_tokens = [
         "[block-quote(1,1)::> ]",
         "[para(1,3):]",
-        "[text(1,3):[:]",
-        "[text(1,4):foo:]",
-        "[text(1,7):]:]",
-        "[text(1,8):::]",
+        "[text(1,3):[foo]::]",
         "[end-para:::True]",
         "[block-quote(2,1)::]",
         "[block-quote(2,2)::>>> ]",
@@ -2008,10 +1881,7 @@ def test_link_reference_definitions_extra_02cx():
         "[block-quote(1,1)::]",
         "[block-quote(1,2)::>> \n> ]",
         "[para(1,4):\n]",
-        "[text(1,4):[:]",
-        "[text(1,5):foo:]",
-        "[text(1,8):]:]",
-        "[text(1,9)::\n/url::\n]",
+        "[text(1,4):[foo]:\n/url::\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-block-quote:::True]",
@@ -2041,10 +1911,7 @@ def test_link_reference_definitions_extra_02ca():
         "[block-quote(1,2)::]",
         "[block-quote(1,3)::>>> \n> ]",
         "[para(1,5):\n]",
-        "[text(1,5):[:]",
-        "[text(1,6):foo:]",
-        "[text(1,9):]:]",
-        "[text(1,10)::\n/url::\n]",
+        "[text(1,5):[foo]:\n/url::\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-block-quote:::True]",
diff --git a/test/gfm/test_markdown_list_blocks.py b/test/gfm/test_markdown_list_blocks.py
index 38fb7fe7..0ec506da 100644
--- a/test/gfm/test_markdown_list_blocks.py
+++ b/test/gfm/test_markdown_list_blocks.py
@@ -2237,8 +2237,7 @@ foo
 1."""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):foo\n::\n]",
-        "[text(2,1):*:]",
+        "[text(1,1):foo\n*::\n]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[para(4,1):\n]",
diff --git a/test/gfm/test_markdown_paragraph_extra.py b/test/gfm/test_markdown_paragraph_extra.py
index c1f0b119..df9a1423 100644
--- a/test/gfm/test_markdown_paragraph_extra.py
+++ b/test/gfm/test_markdown_paragraph_extra.py
@@ -402,11 +402,7 @@ def test_paragraph_extra_49():
 i "testing")a"""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):Foo:]",
-        "[text(1,6):]:]",
-        '[text(1,7):(/ur\ni \a"\a&quot;\atesting\a"\a&quot;\a)a::\n]',
+        '[text(1,1):a[Foo](/ur\ni \a"\a&quot;\atesting\a"\a&quot;\a)a::\n]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a[Foo](/ur\ni &quot;testing&quot;)a</p>"""
@@ -426,11 +422,7 @@ def test_paragraph_extra_49a():
 i "testing")"""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):Foo:]",
-        "[text(1,6):]:]",
-        '[text(1,7):(/ur\ni \a"\a&quot;\atesting\a"\a&quot;\a)::\n]',
+        '[text(1,1):a[Foo](/ur\ni \a"\a&quot;\atesting\a"\a&quot;\a)::\n]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a[Foo](/ur\ni &quot;testing&quot;)</p>"""
@@ -2496,11 +2488,7 @@ def test_paragraph_extra_63():
 i "testing")a"""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):Foo:]",
-        "[text(1,7):]:]",
-        '[text(1,8):(/ur\ni \a"\a&quot;\atesting\a"\a&quot;\a)a::\n]',
+        '[text(1,1):a![Foo](/ur\ni \a"\a&quot;\atesting\a"\a&quot;\a)a::\n]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a![Foo](/ur\ni &quot;testing&quot;)a</p>"""
@@ -2608,11 +2596,7 @@ def test_paragraph_extra_63e():
 i "testing")"""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):Foo:]",
-        "[text(1,7):]:]",
-        '[text(1,8):(/ur\ni \a"\a&quot;\atesting\a"\a&quot;\a)::\n]',
+        '[text(1,1):a![Foo](/ur\ni \a"\a&quot;\atesting\a"\a&quot;\a)::\n]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a![Foo](/ur\ni &quot;testing&quot;)</p>"""
@@ -3279,11 +3263,7 @@ def test_paragraph_extra_67d():
     source_markdown = """a[Foo](/uri "testing"&#xa;)a"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):Foo:]",
-        "[text(1,6):]:]",
-        '[text(1,7):(/uri \a"\a&quot;\atesting\a"\a&quot;\a\a&#xa;\a\n\a)a:]',
+        '[text(1,1):a[Foo](/uri \a"\a&quot;\atesting\a"\a&quot;\a\a&#xa;\a\n\a)a:]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a[Foo](/uri &quot;testing&quot;\n)a</p>"""
@@ -3302,11 +3282,7 @@ def test_paragraph_extra_67e():
     source_markdown = """a![Foo](/uri "testing"&#xa;)a"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):Foo:]",
-        "[text(1,7):]:]",
-        '[text(1,8):(/uri \a"\a&quot;\atesting\a"\a&quot;\a\a&#xa;\a\n\a)a:]',
+        '[text(1,1):a![Foo](/uri \a"\a&quot;\atesting\a"\a&quot;\a\a&#xa;\a\n\a)a:]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a![Foo](/uri &quot;testing&quot;\n)a</p>"""
@@ -3466,11 +3442,7 @@ def test_paragraph_extra_70a():
  uri> "testing")a"""
     expected_tokens = [
         "[para(1,1):\n ]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):Foo:]",
-        "[text(1,6):]:]",
-        '[text(1,7):(\a<\a&lt;\a/my\nuri\a>\a&gt;\a \a"\a&quot;\atesting\a"\a&quot;\a)a::\n]',
+        '[text(1,1):a[Foo](\a<\a&lt;\a/my\nuri\a>\a&gt;\a \a"\a&quot;\atesting\a"\a&quot;\a)a::\n]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a[Foo](&lt;/my\nuri&gt; &quot;testing&quot;)a</p>"""
@@ -3712,11 +3684,7 @@ def test_paragraph_extra_75a():
  uri> "testing")a"""
     expected_tokens = [
         "[para(1,1):\n ]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):Foo:]",
-        "[text(1,7):]:]",
-        '[text(1,8):(\a<\a&lt;\a/my\nuri\a>\a&gt;\a \a"\a&quot;\atesting\a"\a&quot;\a)a::\n]',
+        '[text(1,1):a![Foo](\a<\a&lt;\a/my\nuri\a>\a&gt;\a \a"\a&quot;\atesting\a"\a&quot;\a)a::\n]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a![Foo](&lt;/my\nuri&gt; &quot;testing&quot;)a</p>"""
@@ -4734,14 +4702,11 @@ def test_paragraph_extra_e3():
     source_markdown = """a[foo [bar](/uri)](/uri)a"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):inline:/uri:::::bar:False::::]",
         "[text(1,8):bar:]",
         "[end-link::]",
-        "[text(1,18):]:]",
-        "[text(1,19):(/uri)a:]",
+        "[text(1,18):](/uri)a:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a[foo <a href="/uri">bar</a>](/uri)a</p>"""
@@ -4830,13 +4795,7 @@ def test_paragraph_extra_e4():
         "[para(1,1):]",
         "[text(1,1):a:]",
         "[link(1,2):inline:/uri:::::foo [bar][barx]:False::::]",
-        "[text(1,3):foo :]",
-        "[text(1,7):[:]",
-        "[text(1,8):bar:]",
-        "[text(1,11):]:]",
-        "[text(1,12):[:]",
-        "[text(1,13):barx:]",
-        "[text(1,17):]:]",
+        "[text(1,3):foo [bar][barx]:]",
         "[end-link::]",
         "[text(1,25):a:]",
         "[end-para:::True]",
@@ -4863,13 +4822,7 @@ def test_paragraph_extra_e4a():
         "[para(1,1):]",
         "[text(1,1):a:]",
         "[link(1,2):inline:/uri:::::foo ![bar][barx]:False::::]",
-        "[text(1,3):foo :]",
-        "[text(1,7):![:]",
-        "[text(1,9):bar:]",
-        "[text(1,12):]:]",
-        "[text(1,13):[:]",
-        "[text(1,14):barx:]",
-        "[text(1,18):]:]",
+        "[text(1,3):foo ![bar][barx]:]",
         "[end-link::]",
         "[text(1,26):a:]",
         "[end-para:::True]",
@@ -4944,14 +4897,11 @@ def test_paragraph_extra_e5():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):full:/url:title:::bar:barx:False::::]",
         "[text(1,8):barx:]",
         "[end-link::]",
-        "[text(1,18):]:]",
-        "[text(1,19):(/uri)a:]",
+        "[text(1,18):](/uri)a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -5052,14 +5002,11 @@ def test_paragraph_extra_e6():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):collapsed:/url:title::::bar:False::::]",
         "[text(1,8):bar:]",
         "[end-link::]",
-        "[text(1,14):]:]",
-        "[text(1,15):(/uri)a:]",
+        "[text(1,14):](/uri)a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -5164,12 +5111,7 @@ def test_paragraph_extra_e7():
         "[para(1,1):]",
         "[text(1,1):a:]",
         "[link(1,2):inline:/uri:::::foo [barx][]:False::::]",
-        "[text(1,3):foo :]",
-        "[text(1,7):[:]",
-        "[text(1,8):barx:]",
-        "[text(1,12):]:]",
-        "[text(1,13):[:]",
-        "[text(1,14):]:]",
+        "[text(1,3):foo [barx][]:]",
         "[end-link::]",
         "[text(1,22):a:]",
         "[end-para:::True]",
@@ -5196,12 +5138,7 @@ def test_paragraph_extra_e7a():
         "[para(1,1):]",
         "[text(1,1):a:]",
         "[link(1,2):inline:/uri:::::foo ![barx][]:False::::]",
-        "[text(1,3):foo :]",
-        "[text(1,7):![:]",
-        "[text(1,9):barx:]",
-        "[text(1,13):]:]",
-        "[text(1,14):[:]",
-        "[text(1,15):]:]",
+        "[text(1,3):foo ![barx][]:]",
         "[end-link::]",
         "[text(1,23):a:]",
         "[end-para:::True]",
@@ -5276,14 +5213,11 @@ def test_paragraph_extra_e8():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):shortcut:/url:title::::bar:False::::]",
         "[text(1,8):bar:]",
         "[end-link::]",
-        "[text(1,12):]:]",
-        "[text(1,13):(/uri)a:]",
+        "[text(1,12):](/uri)a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -5388,10 +5322,7 @@ def test_paragraph_extra_e9():
         "[para(1,1):]",
         "[text(1,1):a:]",
         "[link(1,2):inline:/uri:::::foo [barx]:False::::]",
-        "[text(1,3):foo :]",
-        "[text(1,7):[:]",
-        "[text(1,8):barx:]",
-        "[text(1,12):]:]",
+        "[text(1,3):foo [barx]:]",
         "[end-link::]",
         "[text(1,20):a:]",
         "[end-para:::True]",
@@ -5418,10 +5349,7 @@ def test_paragraph_extra_e9a():
         "[para(1,1):]",
         "[text(1,1):a:]",
         "[link(1,2):inline:/uri:::::foo ![barx]:False::::]",
-        "[text(1,3):foo :]",
-        "[text(1,7):![:]",
-        "[text(1,9):barx:]",
-        "[text(1,13):]:]",
+        "[text(1,3):foo ![barx]:]",
         "[end-link::]",
         "[text(1,21):a:]",
         "[end-para:::True]",
@@ -5496,9 +5424,7 @@ def test_paragraph_extra_f0():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):inline:/url2:::::bar2:False::::]",
         "[text(1,8):bar2:]",
         "[end-link::]",
@@ -5607,9 +5533,7 @@ def test_paragraph_extra_f1():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):full:/url:title:::bar:bar2:False::::]",
         "[text(1,8):bar2:]",
         "[end-link::]",
@@ -5720,13 +5644,7 @@ def test_paragraph_extra_f2():
         "[para(1,1):]",
         "[text(1,1):a:]",
         "[link(1,2):full:/url:title:::bar:foo [bar][bar2]:False::::]",
-        "[text(1,3):foo :]",
-        "[text(1,7):[:]",
-        "[text(1,8):bar:]",
-        "[text(1,11):]:]",
-        "[text(1,12):[:]",
-        "[text(1,13):bar2:]",
-        "[text(1,17):]:]",
+        "[text(1,3):foo [bar][bar2]:]",
         "[end-link::]",
         "[text(1,24):a:]",
         "[end-para:::True]",
@@ -5753,13 +5671,7 @@ def test_paragraph_extra_f2a():
         "[para(1,1):]",
         "[text(1,1):a:]",
         "[link(1,2):full:/url:title:::bar:foo ![bar][bar2]:False::::]",
-        "[text(1,3):foo :]",
-        "[text(1,7):![:]",
-        "[text(1,9):bar:]",
-        "[text(1,12):]:]",
-        "[text(1,13):[:]",
-        "[text(1,14):bar2:]",
-        "[text(1,18):]:]",
+        "[text(1,3):foo ![bar][bar2]:]",
         "[end-link::]",
         "[text(1,25):a:]",
         "[end-para:::True]",
@@ -5838,12 +5750,7 @@ def test_paragraph_extra_f3():
         "[para(1,1):]",
         "[text(1,1):a:]",
         "[link(1,2):full:/url:title:::bar:foo [bar2][]:False::::]",
-        "[text(1,3):foo :]",
-        "[text(1,7):[:]",
-        "[text(1,8):bar2:]",
-        "[text(1,12):]:]",
-        "[text(1,13):[:]",
-        "[text(1,14):]:]",
+        "[text(1,3):foo [bar2][]:]",
         "[end-link::]",
         "[text(1,21):a:]",
         "[end-para:::True]",
@@ -5870,12 +5777,7 @@ def test_paragraph_extra_f3a():
         "[para(1,1):]",
         "[text(1,1):a:]",
         "[link(1,2):full:/url:title:::bar:foo ![bar2][]:False::::]",
-        "[text(1,3):foo :]",
-        "[text(1,7):![:]",
-        "[text(1,9):bar2:]",
-        "[text(1,13):]:]",
-        "[text(1,14):[:]",
-        "[text(1,15):]:]",
+        "[text(1,3):foo ![bar2][]:]",
         "[end-link::]",
         "[text(1,22):a:]",
         "[end-para:::True]",
@@ -5950,9 +5852,7 @@ def test_paragraph_extra_f4():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):collapsed:/url:title::::bar:False::::]",
         "[text(1,8):bar:]",
         "[end-link::]",
@@ -6063,10 +5963,7 @@ def test_paragraph_extra_f5():
         "[para(1,1):]",
         "[text(1,1):a:]",
         "[link(1,2):full:/url:title:::bar:foo [bar2]:False::::]",
-        "[text(1,3):foo :]",
-        "[text(1,7):[:]",
-        "[text(1,8):bar2:]",
-        "[text(1,12):]:]",
+        "[text(1,3):foo [bar2]:]",
         "[end-link::]",
         "[text(1,19):a:]",
         "[end-para:::True]",
@@ -6093,10 +5990,7 @@ def test_paragraph_extra_f5a():
         "[para(1,1):]",
         "[text(1,1):a:]",
         "[link(1,2):full:/url:title:::bar:foo ![bar2]:False::::]",
-        "[text(1,3):foo :]",
-        "[text(1,7):![:]",
-        "[text(1,9):bar2:]",
-        "[text(1,13):]:]",
+        "[text(1,3):foo ![bar2]:]",
         "[end-link::]",
         "[text(1,20):a:]",
         "[end-para:::True]",
@@ -6171,9 +6065,7 @@ def test_paragraph_extra_f6():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):shortcut:/url:title::::bar:False::::]",
         "[text(1,8):bar:]",
         "[end-link::]",
@@ -6282,16 +6174,11 @@ def test_paragraph_extra_f7():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):inline:/url2:::::bar2:False::::]",
         "[text(1,8):bar2:]",
         "[end-link::]",
-        "[text(1,20):]:]",
-        "[text(1,21):[:]",
-        "[text(1,22):]:]",
-        "[text(1,23):a:]",
+        "[text(1,20):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6314,14 +6201,9 @@ def test_paragraph_extra_f7a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[image(1,7):inline:/url2::bar2::::bar2:False::::]",
-        "[text(1,21):]:]",
-        "[text(1,22):[:]",
-        "[text(1,23):]:]",
-        "[text(1,24):a:]",
+        "[text(1,21):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6344,14 +6226,9 @@ def test_paragraph_extra_f7b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[image(1,8):inline:/url2::bar2::::bar2:False::::]",
-        "[text(1,22):]:]",
-        "[text(1,23):[:]",
-        "[text(1,24):]:]",
-        "[text(1,25):a:]",
+        "[text(1,22):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6374,16 +6251,11 @@ def test_paragraph_extra_f7c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[link(1,8):inline:/url2:::::bar2:False::::]",
         "[text(1,9):bar2:]",
         "[end-link::]",
-        "[text(1,21):]:]",
-        "[text(1,22):[:]",
-        "[text(1,23):]:]",
-        "[text(1,24):a:]",
+        "[text(1,21):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6406,16 +6278,11 @@ def test_paragraph_extra_f8():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):inline:/url2:::::bar:False::::]",
         "[text(1,8):bar:]",
         "[end-link::]",
-        "[text(1,19):]:]",
-        "[text(1,20):[:]",
-        "[text(1,21):]:]",
-        "[text(1,22):a:]",
+        "[text(1,19):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6438,14 +6305,9 @@ def test_paragraph_extra_f8a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[image(1,7):inline:/url2::bar::::bar:False::::]",
-        "[text(1,20):]:]",
-        "[text(1,21):[:]",
-        "[text(1,22):]:]",
-        "[text(1,23):a:]",
+        "[text(1,20):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6468,14 +6330,9 @@ def test_paragraph_extra_f8b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[image(1,8):inline:/url2::bar::::bar:False::::]",
-        "[text(1,21):]:]",
-        "[text(1,22):[:]",
-        "[text(1,23):]:]",
-        "[text(1,24):a:]",
+        "[text(1,21):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6498,16 +6355,11 @@ def test_paragraph_extra_f8c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[link(1,8):inline:/url2:::::bar:False::::]",
         "[text(1,9):bar:]",
         "[end-link::]",
-        "[text(1,20):]:]",
-        "[text(1,21):[:]",
-        "[text(1,22):]:]",
-        "[text(1,23):a:]",
+        "[text(1,20):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6530,16 +6382,11 @@ def test_paragraph_extra_f9():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):full:/url:title:::bar:bar2:False::::]",
         "[text(1,8):bar2:]",
         "[end-link::]",
-        "[text(1,18):]:]",
-        "[text(1,19):[:]",
-        "[text(1,20):]:]",
-        "[text(1,21):a:]",
+        "[text(1,18):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6562,14 +6409,9 @@ def test_paragraph_extra_f9a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[image(1,7):full:/url:title:bar2:::bar:bar2:False::::]",
-        "[text(1,19):]:]",
-        "[text(1,20):[:]",
-        "[text(1,21):]:]",
-        "[text(1,22):a:]",
+        "[text(1,19):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6592,14 +6434,9 @@ def test_paragraph_extra_f9b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[image(1,8):full:/url:title:bar2:::bar:bar2:False::::]",
-        "[text(1,20):]:]",
-        "[text(1,21):[:]",
-        "[text(1,22):]:]",
-        "[text(1,23):a:]",
+        "[text(1,20):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6622,16 +6459,11 @@ def test_paragraph_extra_f9c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[link(1,8):full:/url:title:::bar:bar2:False::::]",
         "[text(1,9):bar2:]",
         "[end-link::]",
-        "[text(1,19):]:]",
-        "[text(1,20):[:]",
-        "[text(1,21):]:]",
-        "[text(1,22):a:]",
+        "[text(1,19):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6654,19 +6486,7 @@ def test_paragraph_extra_g0():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
-        "[text(1,7):[:]",
-        "[text(1,8):bar2:]",
-        "[text(1,12):]:]",
-        "[text(1,13):[:]",
-        "[text(1,14):bar3:]",
-        "[text(1,18):]:]",
-        "[text(1,19):]:]",
-        "[text(1,20):[:]",
-        "[text(1,21):]:]",
-        "[text(1,22):a:]",
+        "[text(1,1):a[foo [bar2][bar3]][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6689,19 +6509,7 @@ def test_paragraph_extra_g0a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
-        "[text(1,7):![:]",
-        "[text(1,9):bar2:]",
-        "[text(1,13):]:]",
-        "[text(1,14):[:]",
-        "[text(1,15):bar3:]",
-        "[text(1,19):]:]",
-        "[text(1,20):]:]",
-        "[text(1,21):[:]",
-        "[text(1,22):]:]",
-        "[text(1,23):a:]",
+        "[text(1,1):a[foo ![bar2][bar3]][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6724,19 +6532,7 @@ def test_paragraph_extra_g0b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
-        "[text(1,8):![:]",
-        "[text(1,10):bar2:]",
-        "[text(1,14):]:]",
-        "[text(1,15):[:]",
-        "[text(1,16):bar3:]",
-        "[text(1,20):]:]",
-        "[text(1,21):]:]",
-        "[text(1,22):[:]",
-        "[text(1,23):]:]",
-        "[text(1,24):a:]",
+        "[text(1,1):a![foo ![bar2][bar3]][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6759,19 +6555,7 @@ def test_paragraph_extra_g0c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
-        "[text(1,8):[:]",
-        "[text(1,9):bar2:]",
-        "[text(1,13):]:]",
-        "[text(1,14):[:]",
-        "[text(1,15):bar3:]",
-        "[text(1,19):]:]",
-        "[text(1,20):]:]",
-        "[text(1,21):[:]",
-        "[text(1,22):]:]",
-        "[text(1,23):a:]",
+        "[text(1,1):a![foo [bar2][bar3]][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6794,18 +6578,7 @@ def test_paragraph_extra_g1():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
-        "[text(1,7):[:]",
-        "[text(1,8):bar2:]",
-        "[text(1,12):]:]",
-        "[text(1,13):[:]",
-        "[text(1,14):]:]",
-        "[text(1,15):]:]",
-        "[text(1,16):[:]",
-        "[text(1,17):]:]",
-        "[text(1,18):a:]",
+        "[text(1,1):a[foo [bar2][]][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6828,18 +6601,7 @@ def test_paragraph_extra_g1a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
-        "[text(1,7):![:]",
-        "[text(1,9):bar2:]",
-        "[text(1,13):]:]",
-        "[text(1,14):[:]",
-        "[text(1,15):]:]",
-        "[text(1,16):]:]",
-        "[text(1,17):[:]",
-        "[text(1,18):]:]",
-        "[text(1,19):a:]",
+        "[text(1,1):a[foo ![bar2][]][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6862,18 +6624,7 @@ def test_paragraph_extra_g1b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
-        "[text(1,8):![:]",
-        "[text(1,10):bar2:]",
-        "[text(1,14):]:]",
-        "[text(1,15):[:]",
-        "[text(1,16):]:]",
-        "[text(1,17):]:]",
-        "[text(1,18):[:]",
-        "[text(1,19):]:]",
-        "[text(1,20):a:]",
+        "[text(1,1):a![foo ![bar2][]][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6896,18 +6647,7 @@ def test_paragraph_extra_g1c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
-        "[text(1,8):[:]",
-        "[text(1,9):bar2:]",
-        "[text(1,13):]:]",
-        "[text(1,14):[:]",
-        "[text(1,15):]:]",
-        "[text(1,16):]:]",
-        "[text(1,17):[:]",
-        "[text(1,18):]:]",
-        "[text(1,19):a:]",
+        "[text(1,1):a![foo [bar2][]][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6930,16 +6670,11 @@ def test_paragraph_extra_g2():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):collapsed:/url:title::::bar:False::::]",
         "[text(1,8):bar:]",
         "[end-link::]",
-        "[text(1,14):]:]",
-        "[text(1,15):[:]",
-        "[text(1,16):]:]",
-        "[text(1,17):a:]",
+        "[text(1,14):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6962,14 +6697,9 @@ def test_paragraph_extra_g2a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[image(1,7):collapsed:/url:title:bar::::bar:False::::]",
-        "[text(1,15):]:]",
-        "[text(1,16):[:]",
-        "[text(1,17):]:]",
-        "[text(1,18):a:]",
+        "[text(1,15):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -6992,14 +6722,9 @@ def test_paragraph_extra_g2b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[image(1,8):collapsed:/url:title:bar::::bar:False::::]",
-        "[text(1,16):]:]",
-        "[text(1,17):[:]",
-        "[text(1,18):]:]",
-        "[text(1,19):a:]",
+        "[text(1,16):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7022,16 +6747,11 @@ def test_paragraph_extra_g2c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[link(1,8):collapsed:/url:title::::bar:False::::]",
         "[text(1,9):bar:]",
         "[end-link::]",
-        "[text(1,15):]:]",
-        "[text(1,16):[:]",
-        "[text(1,17):]:]",
-        "[text(1,18):a:]",
+        "[text(1,15):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7054,16 +6774,7 @@ def test_paragraph_extra_g3():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
-        "[text(1,7):[:]",
-        "[text(1,8):bar2:]",
-        "[text(1,12):]:]",
-        "[text(1,13):]:]",
-        "[text(1,14):[:]",
-        "[text(1,15):]:]",
-        "[text(1,16):a:]",
+        "[text(1,1):a[foo [bar2]][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7086,16 +6797,7 @@ def test_paragraph_extra_g3a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
-        "[text(1,7):![:]",
-        "[text(1,9):bar2:]",
-        "[text(1,13):]:]",
-        "[text(1,14):]:]",
-        "[text(1,15):[:]",
-        "[text(1,16):]:]",
-        "[text(1,17):a:]",
+        "[text(1,1):a[foo ![bar2]][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7118,16 +6820,7 @@ def test_paragraph_extra_g3b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
-        "[text(1,8):![:]",
-        "[text(1,10):bar2:]",
-        "[text(1,14):]:]",
-        "[text(1,15):]:]",
-        "[text(1,16):[:]",
-        "[text(1,17):]:]",
-        "[text(1,18):a:]",
+        "[text(1,1):a![foo ![bar2]][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7150,16 +6843,7 @@ def test_paragraph_extra_g3c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
-        "[text(1,8):[:]",
-        "[text(1,9):bar2:]",
-        "[text(1,13):]:]",
-        "[text(1,14):]:]",
-        "[text(1,15):[:]",
-        "[text(1,16):]:]",
-        "[text(1,17):a:]",
+        "[text(1,1):a![foo [bar2]][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7182,16 +6866,11 @@ def test_paragraph_extra_g4():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):shortcut:/url:title::::bar:False::::]",
         "[text(1,8):bar:]",
         "[end-link::]",
-        "[text(1,12):]:]",
-        "[text(1,13):[:]",
-        "[text(1,14):]:]",
-        "[text(1,15):a:]",
+        "[text(1,12):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7214,14 +6893,9 @@ def test_paragraph_extra_g4a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[image(1,7):shortcut:/url:title:bar::::bar:False::::]",
-        "[text(1,13):]:]",
-        "[text(1,14):[:]",
-        "[text(1,15):]:]",
-        "[text(1,16):a:]",
+        "[text(1,13):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7244,14 +6918,9 @@ def test_paragraph_extra_g4b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[image(1,8):shortcut:/url:title:bar::::bar:False::::]",
-        "[text(1,14):]:]",
-        "[text(1,15):[:]",
-        "[text(1,16):]:]",
-        "[text(1,17):a:]",
+        "[text(1,14):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7274,16 +6943,11 @@ def test_paragraph_extra_g4c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[link(1,8):shortcut:/url:title::::bar:False::::]",
         "[text(1,9):bar:]",
         "[end-link::]",
-        "[text(1,13):]:]",
-        "[text(1,14):[:]",
-        "[text(1,15):]:]",
-        "[text(1,16):a:]",
+        "[text(1,13):][]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7306,14 +6970,11 @@ def test_paragraph_extra_g5():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):inline:/url2:::::bar2:False::::]",
         "[text(1,8):bar2:]",
         "[end-link::]",
-        "[text(1,20):]:]",
-        "[text(1,21):a:]",
+        "[text(1,20):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7336,12 +6997,9 @@ def test_paragraph_extra_g5a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[image(1,7):inline:/url2::bar2::::bar2:False::::]",
-        "[text(1,21):]:]",
-        "[text(1,22):a:]",
+        "[text(1,21):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7364,12 +7022,9 @@ def test_paragraph_extra_g5b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[image(1,8):inline:/url2::bar2::::bar2:False::::]",
-        "[text(1,22):]:]",
-        "[text(1,23):a:]",
+        "[text(1,22):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7392,14 +7047,11 @@ def test_paragraph_extra_g5c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[link(1,8):inline:/url2:::::bar2:False::::]",
         "[text(1,9):bar2:]",
         "[end-link::]",
-        "[text(1,21):]:]",
-        "[text(1,22):a:]",
+        "[text(1,21):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7422,14 +7074,11 @@ def test_paragraph_extra_g6():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):inline:/url2:::::bar:False::::]",
         "[text(1,8):bar:]",
         "[end-link::]",
-        "[text(1,19):]:]",
-        "[text(1,20):a:]",
+        "[text(1,19):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7452,12 +7101,9 @@ def test_paragraph_extra_g6a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[image(1,7):inline:/url2::bar::::bar:False::::]",
-        "[text(1,20):]:]",
-        "[text(1,21):a:]",
+        "[text(1,20):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7480,12 +7126,9 @@ def test_paragraph_extra_g6b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[image(1,8):inline:/url2::bar::::bar:False::::]",
-        "[text(1,21):]:]",
-        "[text(1,22):a:]",
+        "[text(1,21):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7508,14 +7151,11 @@ def test_paragraph_extra_g6c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[link(1,8):inline:/url2:::::bar:False::::]",
         "[text(1,9):bar:]",
         "[end-link::]",
-        "[text(1,20):]:]",
-        "[text(1,21):a:]",
+        "[text(1,20):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7538,14 +7178,11 @@ def test_paragraph_extra_g7():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):full:/url:title:::bar:bar2:False::::]",
         "[text(1,8):bar2:]",
         "[end-link::]",
-        "[text(1,18):]:]",
-        "[text(1,19):a:]",
+        "[text(1,18):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7568,12 +7205,9 @@ def test_paragraph_extra_g7a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[image(1,7):full:/url:title:bar2:::bar:bar2:False::::]",
-        "[text(1,19):]:]",
-        "[text(1,20):a:]",
+        "[text(1,19):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7596,12 +7230,9 @@ def test_paragraph_extra_g7b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[image(1,8):full:/url:title:bar2:::bar:bar2:False::::]",
-        "[text(1,20):]:]",
-        "[text(1,21):a:]",
+        "[text(1,20):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7624,14 +7255,11 @@ def test_paragraph_extra_g7c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[link(1,8):full:/url:title:::bar:bar2:False::::]",
         "[text(1,9):bar2:]",
         "[end-link::]",
-        "[text(1,19):]:]",
-        "[text(1,20):a:]",
+        "[text(1,19):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7654,14 +7282,11 @@ def test_paragraph_extra_g8():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):full:/url:title:::bar:bar:False::::]",
         "[text(1,8):bar:]",
         "[end-link::]",
-        "[text(1,17):]:]",
-        "[text(1,18):a:]",
+        "[text(1,17):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7684,12 +7309,9 @@ def test_paragraph_extra_g8a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[image(1,7):full:/url:title:bar:::bar:bar:False::::]",
-        "[text(1,18):]:]",
-        "[text(1,19):a:]",
+        "[text(1,18):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7712,12 +7334,9 @@ def test_paragraph_extra_g8b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[image(1,8):full:/url:title:bar:::bar:bar:False::::]",
-        "[text(1,19):]:]",
-        "[text(1,20):a:]",
+        "[text(1,19):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7740,14 +7359,11 @@ def test_paragraph_extra_g8c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[link(1,8):full:/url:title:::bar:bar:False::::]",
         "[text(1,9):bar:]",
         "[end-link::]",
-        "[text(1,18):]:]",
-        "[text(1,19):a:]",
+        "[text(1,18):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7770,16 +7386,7 @@ def test_paragraph_extra_g9():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
-        "[text(1,7):[:]",
-        "[text(1,8):bar2:]",
-        "[text(1,12):]:]",
-        "[text(1,13):[:]",
-        "[text(1,14):]:]",
-        "[text(1,15):]:]",
-        "[text(1,16):a:]",
+        "[text(1,1):a[foo [bar2][]]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7802,16 +7409,7 @@ def test_paragraph_extra_g9a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
-        "[text(1,7):![:]",
-        "[text(1,9):bar2:]",
-        "[text(1,13):]:]",
-        "[text(1,14):[:]",
-        "[text(1,15):]:]",
-        "[text(1,16):]:]",
-        "[text(1,17):a:]",
+        "[text(1,1):a[foo ![bar2][]]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7834,16 +7432,7 @@ def test_paragraph_extra_g9b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
-        "[text(1,8):![:]",
-        "[text(1,10):bar2:]",
-        "[text(1,14):]:]",
-        "[text(1,15):[:]",
-        "[text(1,16):]:]",
-        "[text(1,17):]:]",
-        "[text(1,18):a:]",
+        "[text(1,1):a![foo ![bar2][]]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7866,16 +7455,7 @@ def test_paragraph_extra_g9c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
-        "[text(1,8):[:]",
-        "[text(1,9):bar2:]",
-        "[text(1,13):]:]",
-        "[text(1,14):[:]",
-        "[text(1,15):]:]",
-        "[text(1,16):]:]",
-        "[text(1,17):a:]",
+        "[text(1,1):a![foo [bar2][]]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7898,14 +7478,11 @@ def test_paragraph_extra_h0():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):collapsed:/url:title::::bar:False::::]",
         "[text(1,8):bar:]",
         "[end-link::]",
-        "[text(1,14):]:]",
-        "[text(1,15):a:]",
+        "[text(1,14):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7928,12 +7505,9 @@ def test_paragraph_extra_h0a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[image(1,7):collapsed:/url:title:bar::::bar:False::::]",
-        "[text(1,15):]:]",
-        "[text(1,16):a:]",
+        "[text(1,15):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7956,12 +7530,9 @@ def test_paragraph_extra_h0b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[image(1,8):collapsed:/url:title:bar::::bar:False::::]",
-        "[text(1,16):]:]",
-        "[text(1,17):a:]",
+        "[text(1,16):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -7984,14 +7555,11 @@ def test_paragraph_extra_h0c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[link(1,8):collapsed:/url:title::::bar:False::::]",
         "[text(1,9):bar:]",
         "[end-link::]",
-        "[text(1,15):]:]",
-        "[text(1,16):a:]",
+        "[text(1,15):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -8014,14 +7582,7 @@ def test_paragraph_extra_h1():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
-        "[text(1,7):[:]",
-        "[text(1,8):bar2:]",
-        "[text(1,12):]:]",
-        "[text(1,13):]:]",
-        "[text(1,14):a:]",
+        "[text(1,1):a[foo [bar2]]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -8044,14 +7605,7 @@ def test_paragraph_extra_h1a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
-        "[text(1,7):![:]",
-        "[text(1,9):bar2:]",
-        "[text(1,13):]:]",
-        "[text(1,14):]:]",
-        "[text(1,15):a:]",
+        "[text(1,1):a[foo ![bar2]]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -8074,14 +7628,7 @@ def test_paragraph_extra_h1b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
-        "[text(1,8):![:]",
-        "[text(1,10):bar2:]",
-        "[text(1,14):]:]",
-        "[text(1,15):]:]",
-        "[text(1,16):a:]",
+        "[text(1,1):a![foo ![bar2]]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -8104,14 +7651,7 @@ def test_paragraph_extra_h1c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
-        "[text(1,8):[:]",
-        "[text(1,9):bar2:]",
-        "[text(1,13):]:]",
-        "[text(1,14):]:]",
-        "[text(1,15):a:]",
+        "[text(1,1):a![foo [bar2]]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -8134,14 +7674,11 @@ def test_paragraph_extra_h2():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[link(1,7):shortcut:/url:title::::bar:False::::]",
         "[text(1,8):bar:]",
         "[end-link::]",
-        "[text(1,12):]:]",
-        "[text(1,13):a:]",
+        "[text(1,12):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -8164,12 +7701,9 @@ def test_paragraph_extra_h2a():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):foo :]",
+        "[text(1,1):a[foo :]",
         "[image(1,7):shortcut:/url:title:bar::::bar:False::::]",
-        "[text(1,13):]:]",
-        "[text(1,14):a:]",
+        "[text(1,13):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -8192,12 +7726,9 @@ def test_paragraph_extra_h2b():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[image(1,8):shortcut:/url:title:bar::::bar:False::::]",
-        "[text(1,14):]:]",
-        "[text(1,15):a:]",
+        "[text(1,14):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
@@ -8220,14 +7751,11 @@ def test_paragraph_extra_h2c():
 [bar]: /url 'title'"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):foo :]",
+        "[text(1,1):a![foo :]",
         "[link(1,8):shortcut:/url:title::::bar:False::::]",
         "[text(1,9):bar:]",
         "[end-link::]",
-        "[text(1,13):]:]",
-        "[text(1,14):a:]",
+        "[text(1,13):]a:]",
         "[end-para:::True]",
         "[BLANK(2,1):    ]",
         "[link-ref-def(3,1):True::bar:: :/url:: :title:'title':]",
diff --git a/test/gfm/test_markdown_raw_html.py b/test/gfm/test_markdown_raw_html.py
index 5a03f470..29393bbc 100644
--- a/test/gfm/test_markdown_raw_html.py
+++ b/test/gfm/test_markdown_raw_html.py
@@ -306,9 +306,7 @@ def test_raw_html_637():
     source_markdown = """<33> <__>"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):\a<\a&lt;\a33\a>\a&gt;\a \a<\a&lt;\a:]",
-        "[text(1,7):__:]",
-        "[text(1,9):\a>\a&gt;\a:]",
+        "[text(1,1):\a<\a&lt;\a33\a>\a&gt;\a \a<\a&lt;\a__\a>\a&gt;\a:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>&lt;33&gt; &lt;__&gt;</p>"""
@@ -327,9 +325,7 @@ def test_raw_html_638():
     source_markdown = """<a h*#ref="hi">"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):\a<\a&lt;\aa h:]",
-        "[text(1,5):*:]",
-        '[text(1,6):#ref=\a"\a&quot;\ahi\a"\a&quot;\a\a>\a&gt;\a:]',
+        '[text(1,1):\a<\a&lt;\aa h*#ref=\a"\a&quot;\ahi\a"\a&quot;\a\a>\a&gt;\a:]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>&lt;a h*#ref=&quot;hi&quot;&gt;</p>"""
@@ -652,11 +648,7 @@ def test_raw_html_646a():
     source_markdown = """foo <![CDATA[>&<>"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):foo \a<\a&lt;\a:]",
-        "[text(1,6):![:]",
-        "[text(1,8):CDATA:]",
-        "[text(1,13):[:]",
-        "[text(1,14):\a>\a&gt;\a\a&\a&amp;\a\a<\a&lt;\a\a>\a&gt;\a:]",
+        "[text(1,1):foo \a<\a&lt;\a![CDATA[\a>\a&gt;\a\a&\a&amp;\a\a<\a&lt;\a\a>\a&gt;\a:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>foo &lt;![CDATA[&gt;&amp;&lt;&gt;</p>"""
diff --git a/test/gfm/test_markdown_reference_links.py b/test/gfm/test_markdown_reference_links.py
index b75b91da..511028e1 100644
--- a/test/gfm/test_markdown_reference_links.py
+++ b/test/gfm/test_markdown_reference_links.py
@@ -105,13 +105,7 @@ def test_reference_links_536():
     expected_tokens = [
         "[para(1,1):]",
         "[link(1,1):full:/uri::::ref:link [foo [bar]]:False::::]",
-        "[text(1,2):link :]",
-        "[text(1,7):[:]",
-        "[text(1,8):foo :]",
-        "[text(1,12):[:]",
-        "[text(1,13):bar:]",
-        "[text(1,16):]:]",
-        "[text(1,17):]:]",
+        "[text(1,2):link [foo [bar]]:]",
         "[end-link::]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
@@ -218,8 +212,7 @@ def test_reference_links_540():
 [ref]: /uri"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo :]",
+        "[text(1,1):[foo :]",
         "[link(1,6):inline:/uri:::::bar:False::::]",
         "[text(1,7):bar:]",
         "[end-link::]",
@@ -249,8 +242,7 @@ def test_reference_links_541():
 [ref]: /uri"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo :]",
+        "[text(1,1):[foo :]",
         "[emphasis(1,6):1:*]",
         "[text(1,7):bar :]",
         "[link(1,11):full:/uri::::ref:baz:False::::]",
@@ -287,8 +279,7 @@ def test_reference_links_542():
         "[para(1,1):]",
         "[text(1,1):*:]",
         "[link(1,2):full:/uri::::ref:foo*:False::::]",
-        "[text(1,3):foo:]",
-        "[text(1,6):*:]",
+        "[text(1,3):foo*:]",
         "[end-link::]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
@@ -313,9 +304,7 @@ def test_reference_links_543():
     expected_tokens = [
         "[para(1,1):]",
         "[link(1,1):full:/uri::::ref:foo *bar:False::::]",
-        "[text(1,2):foo :]",
-        "[text(1,6):*:]",
-        "[text(1,7):bar:]",
+        "[text(1,2):foo *bar:]",
         "[end-link::]",
         "[text(1,16):*:]",
         "[end-para:::True]",
@@ -340,8 +329,7 @@ def test_reference_links_544():
 [ref]: /uri"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo :]",
+        "[text(1,1):[foo :]",
         '[raw-html(1,6):bar attr="][ref]"]',
         "[end-para:::True]",
         "[BLANK(2,1):]",
@@ -365,8 +353,7 @@ def test_reference_links_545():
 [ref]: /uri"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
+        "[text(1,1):[foo:]",
         "[icode-span(1,5):][ref]:`::]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
@@ -390,8 +377,7 @@ def test_reference_links_546():
 [ref]: /uri"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
+        "[text(1,1):[foo:]",
         "[uri-autolink(1,5):http://example.com/?search=][ref]]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
@@ -595,12 +581,7 @@ def test_reference_links_549c():
         "[link-ref-def(1,1):True::foo bar:Foo bar: :/url:::::]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):Baz:]",
-        "[text(3,5):]:]",
-        "[text(3,6):[:]",
-        "[text(3,7):\u00a0Foo  bar :]",
-        "[text(3,17):]:]",
+        "[text(3,1):[Baz][\u00a0Foo  bar ]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[Baz][\u00a0Foo  bar ]</p>"""
@@ -623,12 +604,7 @@ def test_reference_links_549d():
         "[link-ref-def(1,1):True::foo bar:Foo bar: :/url:::::]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):Baz:]",
-        "[text(3,5):]:]",
-        "[text(3,6):[:]",
-        "[text(3,7): Foo  bar\u00a0:]",
-        "[text(3,17):]:]",
+        "[text(3,1):[Baz][ Foo  bar\u00a0]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[Baz][ Foo  bar\u00a0]</p>"""
@@ -651,12 +627,7 @@ def test_reference_links_549e():
         "[link-ref-def(1,1):True::foo bar:Foo bar: :/url:::::]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):Baz:]",
-        "[text(3,5):]:]",
-        "[text(3,6):[:]",
-        "[text(3,7): Foo\u00a0\u00a0bar :]",
-        "[text(3,17):]:]",
+        "[text(3,1):[Baz][ Foo\u00a0\u00a0bar ]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[Baz][ Foo\u00a0\u00a0bar ]</p>"""
@@ -678,10 +649,7 @@ def test_reference_links_550():
 """
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):]:]",
-        "[text(1,6): :]",
+        "[text(1,1):[foo] :]",
         "[link(1,7):shortcut:/url:title::::bar:False::::]",
         "[text(1,8):bar:]",
         "[end-link::]",
@@ -710,10 +678,7 @@ def test_reference_links_551():
 """
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):]:]",
-        "[text(1,6):\n::\n]",
+        "[text(1,1):[foo]\n::\n]",
         "[link(2,1):shortcut:/url:title::::bar:False::::]",
         "[text(2,2):bar:]",
         "[end-link::]",
@@ -770,12 +735,7 @@ def test_reference_links_553():
 [foo!]: /url"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):bar:]",
-        "[text(1,5):]:]",
-        "[text(1,6):[:]",
-        "[text(1,7):foo\\\b!:]",
-        "[text(1,12):]:]",
+        "[text(1,1):[bar][foo\\\b!]:]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[link-ref-def(3,1):True::foo!:: :/url:::::]",
@@ -798,21 +758,11 @@ def test_reference_links_554():
 [ref[]: /uri"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):]:]",
-        "[text(1,6):[:]",
-        "[text(1,7):ref:]",
-        "[text(1,10):[:]",
-        "[text(1,11):]:]",
+        "[text(1,1):[foo][ref[]:]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):ref:]",
-        "[text(3,5):[:]",
-        "[text(3,6):]:]",
-        "[text(3,7):: /uri:]",
+        "[text(3,1):[ref[]: /uri:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[foo][ref[]</p>
@@ -834,25 +784,11 @@ def test_reference_links_555():
 [ref[bar]]: /uri"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):]:]",
-        "[text(1,6):[:]",
-        "[text(1,7):ref:]",
-        "[text(1,10):[:]",
-        "[text(1,11):bar:]",
-        "[text(1,14):]:]",
-        "[text(1,15):]:]",
+        "[text(1,1):[foo][ref[bar]]:]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):ref:]",
-        "[text(3,5):[:]",
-        "[text(3,6):bar:]",
-        "[text(3,9):]:]",
-        "[text(3,10):]:]",
-        "[text(3,11):: /uri:]",
+        "[text(3,1):[ref[bar]]: /uri:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[foo][ref[bar]]</p>
@@ -874,24 +810,11 @@ def test_reference_links_556():
 [[[foo]]]: /url"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):[:]",
-        "[text(1,3):[:]",
-        "[text(1,4):foo:]",
-        "[text(1,7):]:]",
-        "[text(1,8):]:]",
-        "[text(1,9):]:]",
+        "[text(1,1):[[[foo]]]:]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):[:]",
-        "[text(3,3):[:]",
-        "[text(3,4):foo:]",
-        "[text(3,7):]:]",
-        "[text(3,8):]:]",
-        "[text(3,9):]:]",
-        "[text(3,10):: /url:]",
+        "[text(3,1):[[[foo]]]: /url:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[[[foo]]]</p>
@@ -1013,14 +936,11 @@ def test_reference_links_559():
 []: /uri"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):]:]",
+        "[text(1,1):[]:]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):]:]",
-        "[text(3,3):: /uri:]",
+        "[text(3,1):[]: /uri:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[]</p>
@@ -1044,16 +964,11 @@ def test_reference_links_560():
  ]: /uri"""
     expected_tokens = [
         "[para(1,1):\n ]",
-        "[text(1,1):[:]",
-        "[text(1,2):\n::\n]",
-        "[text(2,2):]:]",
+        "[text(1,1):[\n]::\n]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[para(4,1):\n ]",
-        "[text(4,1):[:]",
-        "[text(4,2):\n::\n]",
-        "[text(5,2):]:]",
-        "[text(5,3):: /uri:]",
+        "[text(4,1):[\n]: /uri::\n]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[
@@ -1168,9 +1083,7 @@ def test_reference_links_564():
         "[link(1,1):shortcut:/url:title::::foo:False::::]",
         "[text(1,2):foo:]",
         "[end-link::]",
-        "[text(1,6):\n:: \n]",
-        "[text(2,1):[:]",
-        "[text(2,2):]:]",
+        "[text(1,6):\n[]:: \n]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         '[link-ref-def(4,1):True::foo:: :/url:: :title:"title":]',
@@ -1284,9 +1197,7 @@ def test_reference_links_568():
 [foo]: /url"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):[:]",
-        "[text(1,3):bar :]",
+        "[text(1,1):[[bar :]",
         "[link(1,7):shortcut:/url:::::foo:False::::]",
         "[text(1,8):foo:]",
         "[end-link::]",
@@ -1366,8 +1277,7 @@ def test_reference_links_570a():
 """
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
+        "[text(1,1):[foo:]",
         "[link(1,5):shortcut:/url:title::::foo:False::::]",
         "[text(1,6):foo:]",
         "[end-link::]",
@@ -1396,8 +1306,7 @@ def test_reference_links_571():
 """
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):\\\b[foo:]",
-        "[text(1,6):]:]",
+        "[text(1,1):\\\b[foo]:]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         '[link-ref-def(3,1):True::foo:: :/url:: :title:"title":]',
@@ -1425,8 +1334,7 @@ def test_reference_links_572():
         "[para(3,1):]",
         "[text(3,1):*:]",
         "[link(3,2):shortcut:/url:::::foo*:False::::]",
-        "[text(3,3):foo:]",
-        "[text(3,6):*:]",
+        "[text(3,3):foo*:]",
         "[end-link::]",
         "[end-para:::True]",
     ]
@@ -1551,9 +1459,7 @@ def test_reference_links_577():
 [baz]: /url"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):]:]",
+        "[text(1,1):[foo]:]",
         "[link(1,6):full:/url::::baz:bar:False::::]",
         "[text(1,7):bar:]",
         "[end-link::]",
@@ -1610,9 +1516,7 @@ def test_reference_links_579():
 [foo]: /url2"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo:]",
-        "[text(1,5):]:]",
+        "[text(1,1):[foo]:]",
         "[link(1,6):full:/url1::::baz:bar:False::::]",
         "[text(1,7):bar:]",
         "[end-link::]",
@@ -1731,14 +1635,11 @@ def test_reference_links_extra_03xa():
 [bar\\foo]: /uri1"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):xx:]",
+        "[text(1,1):[xx:]",
         "[link(1,4):shortcut:/uri1:::::bar\\foo:False::::]",
         "[text(1,5):bar\\foo:]",
         "[end-link::]",
-        "[text(1,13):yy:]",
-        "[text(1,15):]:]",
-        "[text(1,16):(/uri):]",
+        "[text(1,13):yy](/uri):]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[link-ref-def(3,1):True::bar\\foo:: :/uri1:::::]",
@@ -1838,14 +1739,11 @@ def test_reference_links_extra_03aa():
 [bar&amp;foo]: /uri"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):xx:]",
+        "[text(1,1):[xx:]",
         "[link(1,4):shortcut:/uri:::::bar&amp;foo:False::::]",
         "[text(1,5):bar\a&amp;\a\a&\a&amp;\a\afoo:]",
         "[end-link::]",
-        "[text(1,17):yy:]",
-        "[text(1,19):]:]",
-        "[text(1,20):(/uri1):]",
+        "[text(1,17):yy](/uri1):]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[link-ref-def(3,1):True::bar&amp;foo:: :/uri:::::]",
@@ -1945,14 +1843,11 @@ def test_reference_links_extra_03ba():
         "[link-ref-def(1,1):True::bar&copy;foo:: :/uri:::::]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):xx:]",
+        "[text(3,1):[xx:]",
         "[link(3,4):shortcut:/uri:::::bar&copy;foo:False::::]",
         "[text(3,5):bar\a&copy;\a©\afoo:]",
         "[end-link::]",
-        "[text(3,18):yy:]",
-        "[text(3,20):]:]",
-        "[text(3,21):(/uri1):]",
+        "[text(3,18):yy](/uri1):]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[xx<a href="/uri">bar©foo</a>yy](/uri1)</p>"""
@@ -2050,16 +1945,13 @@ def test_reference_links_extra_03ca():
 [bar` span `foo]: /uri"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):xx:]",
+        "[text(1,1):[xx:]",
         "[link(1,4):shortcut:/uri:::::bar` span `foo:False::::]",
         "[text(1,5):bar:]",
         "[icode-span(1,8):span:`: : ]",
         "[text(1,16):foo:]",
         "[end-link::]",
-        "[text(1,20):yy:]",
-        "[text(1,22):]:]",
-        "[text(1,23):(/uri1):]",
+        "[text(1,20):yy](/uri1):]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[link-ref-def(3,1):True::bar` span `foo:: :/uri:::::]",
@@ -2163,8 +2055,7 @@ def test_reference_links_extra_03da():
 [bar*span*foo]: /uri"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):xx:]",
+        "[text(1,1):[xx:]",
         "[link(1,4):shortcut:/uri:::::bar*span*foo:False::::]",
         "[text(1,5):bar:]",
         "[emphasis(1,8):1:*]",
@@ -2172,9 +2063,7 @@ def test_reference_links_extra_03da():
         "[end-emphasis(1,13)::]",
         "[text(1,14):foo:]",
         "[end-link::]",
-        "[text(1,18):yy:]",
-        "[text(1,20):]:]",
-        "[text(1,21):(/uri1):]",
+        "[text(1,18):yy](/uri1):]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[link-ref-def(3,1):True::bar*span*foo:: :/uri:::::]",
@@ -2276,16 +2165,13 @@ def test_reference_links_extra_03ea():
 [bar<http://autolink.com>foo]: /uri"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):xx:]",
+        "[text(1,1):[xx:]",
         "[link(1,4):shortcut:/uri:::::bar<http://autolink.com>foo:False::::]",
         "[text(1,5):bar:]",
         "[uri-autolink(1,8):http://autolink.com]",
         "[text(1,29):foo:]",
         "[end-link::]",
-        "[text(1,33):yy:]",
-        "[text(1,35):]:]",
-        "[text(1,36):(/uri1):]",
+        "[text(1,33):yy](/uri1):]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[link-ref-def(3,1):True::bar<http://autolink.com>foo:: :/uri:::::]",
@@ -2385,16 +2271,13 @@ def test_reference_links_extra_03fa():
 [bar<image src="xx">foo]: /uri"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):xx:]",
+        "[text(1,1):[xx:]",
         '[link(1,4):shortcut:/uri:::::bar<image src="xx">foo:False::::]',
         "[text(1,5):bar:]",
         '[raw-html(1,8):image src="xx"]',
         "[text(1,24):foo:]",
         "[end-link::]",
-        "[text(1,28):yy:]",
-        "[text(1,30):]:]",
-        "[text(1,31):(/uri1):]",
+        "[text(1,28):yy](/uri1):]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         '[link-ref-def(3,1):True::bar<image src="xx">foo:: :/uri:::::]',
@@ -2497,14 +2380,11 @@ foo]: /uri
 """
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):[:]",
-        "[text(1,2):xx:]",
+        "[text(1,1):[xx:]",
         "[link(1,4):shortcut:/uri:::::bar\nfoo:False::::]",
         "[text(1,5):bar\nfoo::\n]",
         "[end-link::]",
-        "[text(2,5):yy:]",
-        "[text(2,7):]:]",
-        "[text(2,8):(/uri1):]",
+        "[text(2,5):yy](/uri1):]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[link-ref-def(4,1):True::bar foo:bar\nfoo: :/uri:::::]",
@@ -2589,20 +2469,15 @@ foo]: /uri
 foo]"""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):[:]",
-        "[text(1,2):bar:]",
+        "[text(1,1):[bar:]",
         "[hard-break(1,5):\\:\n]",
-        "[text(2,1):foo:]",
-        "[text(2,4):]:]",
-        "[text(2,5):: /uri:]",
+        "[text(2,1):foo]: /uri:]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[para(4,1):\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):bar:]",
+        "[text(4,1):[bar:]",
         "[hard-break(4,5):\\:\n]",
-        "[text(5,1):foo:]",
-        "[text(5,4):]:]",
+        "[text(5,1):foo]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[bar<br />
@@ -2630,16 +2505,13 @@ foo]"""
         "[para(1,1):\n]",
         "[text(1,1):[:]",
         "[hard-break(1,2):\\:\n]",
-        "[text(2,1):foo:]",
-        "[text(2,4):]:]",
-        "[text(2,5):: /uri:]",
+        "[text(2,1):foo]: /uri:]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[para(4,1):\n]",
         "[text(4,1):[:]",
         "[hard-break(4,2):\\:\n]",
-        "[text(5,1):foo:]",
-        "[text(5,4):]:]",
+        "[text(5,1):foo]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[<br />
@@ -2665,20 +2537,15 @@ foo]: /uri
 foo]"""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):[:]",
-        "[text(1,2):b\\ar:]",
+        "[text(1,1):[b\\ar:]",
         "[hard-break(1,6):\\:\n]",
-        "[text(2,1):foo:]",
-        "[text(2,4):]:]",
-        "[text(2,5):: /uri:]",
+        "[text(2,1):foo]: /uri:]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[para(4,1):\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):b\\ar:]",
+        "[text(4,1):[b\\ar:]",
         "[hard-break(4,6):\\:\n]",
-        "[text(5,1):foo:]",
-        "[text(5,4):]:]",
+        "[text(5,1):foo]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[b\\ar<br />
@@ -2732,24 +2599,15 @@ foo]: /uri
 foo]yy]"""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):[:]",
-        "[text(1,2):bar:]",
+        "[text(1,1):[bar:]",
         "[hard-break(1,5):\\:\n]",
-        "[text(2,1):foo:]",
-        "[text(2,4):]:]",
-        "[text(2,5):: /uri:]",
+        "[text(2,1):foo]: /uri:]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[para(4,1):\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):xx:]",
-        "[text(4,4):[:]",
-        "[text(4,5):bar:]",
+        "[text(4,1):[xx[bar:]",
         "[hard-break(4,8):\\:\n]",
-        "[text(5,1):foo:]",
-        "[text(5,4):]:]",
-        "[text(5,5):yy:]",
-        "[text(5,7):]:]",
+        "[text(5,1):foo]yy]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[bar<br />
@@ -2775,24 +2633,15 @@ foo]: /uri
 foo]yy]"""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):[:]",
-        "[text(1,2):bar:]",
+        "[text(1,1):[bar:]",
         "[hard-break(1,5):\\:\n]",
-        "[text(2,1):foo:]",
-        "[text(2,4):]:]",
-        "[text(2,5):: /uri:]",
+        "[text(2,1):foo]: /uri:]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[para(4,1):\n]",
-        "[text(4,1):![:]",
-        "[text(4,3):xx:]",
-        "[text(4,5):[:]",
-        "[text(4,6):bar:]",
+        "[text(4,1):![xx[bar:]",
         "[hard-break(4,9):\\:\n]",
-        "[text(5,1):foo:]",
-        "[text(5,4):]:]",
-        "[text(5,5):yy:]",
-        "[text(5,7):]:]",
+        "[text(5,1):foo]yy]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[bar<br />
@@ -2818,24 +2667,15 @@ foo]: /uri
 foo]yy]"""
     expected_tokens = [
         "[para(1,1):\n]",
-        "[text(1,1):[:]",
-        "[text(1,2):bar:]",
+        "[text(1,1):[bar:]",
         "[hard-break(1,5):\\:\n]",
-        "[text(2,1):foo:]",
-        "[text(2,4):]:]",
-        "[text(2,5):: /uri:]",
+        "[text(2,1):foo]: /uri:]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[para(4,1):\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):xx:]",
-        "[text(4,4):![:]",
-        "[text(4,6):bar:]",
+        "[text(4,1):[xx![bar:]",
         "[hard-break(4,9):\\:\n]",
-        "[text(5,1):foo:]",
-        "[text(5,4):]:]",
-        "[text(5,5):yy:]",
-        "[text(5,7):]:]",
+        "[text(5,1):foo]yy]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[bar<br />
@@ -2897,15 +2737,13 @@ foo]yy]""".replace(
         "[link-ref-def(1,1):True::bar foo:bar  \nfoo: :/uri:::::]",
         "[BLANK(3,1):]",
         "[para(4,1):\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):xx:]",
+        "[text(4,1):[xx:]",
         "[link(4,4):shortcut:/uri:::::bar  \nfoo:False::::]",
         "[text(4,5):bar:]",
         "[hard-break(4,8):  :\n]",
         "[text(5,1):foo:]",
         "[end-link::]",
-        "[text(5,5):yy:]",
-        "[text(5,7):]:]",
+        "[text(5,5):yy]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[xx<a href="/uri">bar<br />
@@ -2933,15 +2771,13 @@ foo]yy]""".replace(
         "[link-ref-def(1,1):True::bar foo:bar  \nfoo: :/uri:::::]",
         "[BLANK(3,1):]",
         "[para(4,1):\n]",
-        "[text(4,1):![:]",
-        "[text(4,3):xx:]",
+        "[text(4,1):![xx:]",
         "[link(4,5):shortcut:/uri:::::bar  \nfoo:False::::]",
         "[text(4,6):bar:]",
         "[hard-break(4,9):  :\n]",
         "[text(5,1):foo:]",
         "[end-link::]",
-        "[text(5,5):yy:]",
-        "[text(5,7):]:]",
+        "[text(5,5):yy]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>![xx<a href="/uri">bar<br />
@@ -2969,11 +2805,9 @@ foo]yy]""".replace(
         "[link-ref-def(1,1):True::bar foo:bar  \nfoo: :/uri:::::]",
         "[BLANK(3,1):]",
         "[para(4,1):\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):xx:]",
+        "[text(4,1):[xx:]",
         "[image(4,4):shortcut:/uri::bar\nfoo::::bar  \nfoo:False::::]",
-        "[text(5,5):yy:]",
-        "[text(5,7):]:]",
+        "[text(5,5):yy]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[xx<img src="/uri" alt="bar
diff --git a/test/gfm/test_markdown_setext_headings_extra.py b/test/gfm/test_markdown_setext_headings_extra.py
index f8377a54..e6f53509 100644
--- a/test/gfm/test_markdown_setext_headings_extra.py
+++ b/test/gfm/test_markdown_setext_headings_extra.py
@@ -1250,11 +1250,7 @@ i "testing")a
 ---"""
     expected_tokens = [
         "[setext(3,1):-:3::(1,1)]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):Foo:]",
-        "[text(1,6):]:]",
-        '[text(1,7):(/ur\ni \a"\a&quot;\atesting\a"\a&quot;\a)a::\n]',
+        '[text(1,1):a[Foo](/ur\ni \a"\a&quot;\atesting\a"\a&quot;\a)a::\n]',
         "[end-setext::]",
     ]
     expected_gfm = """<h2>a[Foo](/ur\ni &quot;testing&quot;)a</h2>"""
@@ -1853,11 +1849,7 @@ i "testing")a
 ---"""
     expected_tokens = [
         "[setext(3,1):-:3::(1,1)]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):Foo:]",
-        "[text(1,7):]:]",
-        '[text(1,8):(/ur\ni \a"\a&quot;\atesting\a"\a&quot;\a)a::\n]',
+        '[text(1,1):a![Foo](/ur\ni \a"\a&quot;\atesting\a"\a&quot;\a)a::\n]',
         "[end-setext::]",
     ]
     expected_gfm = """<h2>a![Foo](/ur\ni &quot;testing&quot;)a</h2>"""
@@ -2262,11 +2254,7 @@ def test_setext_headings_extra_70a():
 ---"""
     expected_tokens = [
         "[setext(3,1):-:3::(1,1)]",
-        "[text(1,1):a:]",
-        "[text(1,2):[:]",
-        "[text(1,3):Foo:]",
-        "[text(1,6):]:]",
-        '[text(1,7):(\a<\a&lt;\a/my\nuri\a>\a&gt;\a \a"\a&quot;\atesting\a"\a&quot;\a)a::\n \x02]',
+        '[text(1,1):a[Foo](\a<\a&lt;\a/my\nuri\a>\a&gt;\a \a"\a&quot;\atesting\a"\a&quot;\a)a::\n \x02]',
         "[end-setext::]",
     ]
     expected_gfm = """<h2>a[Foo](&lt;/my\nuri&gt; &quot;testing&quot;)a</h2>"""
@@ -2519,11 +2507,7 @@ def test_setext_headings_extra_75a():
 ---"""
     expected_tokens = [
         "[setext(3,1):-:3::(1,1)]",
-        "[text(1,1):a:]",
-        "[text(1,2):![:]",
-        "[text(1,4):Foo:]",
-        "[text(1,7):]:]",
-        '[text(1,8):(\a<\a&lt;\a/my\nuri\a>\a&gt;\a \a"\a&quot;\atesting\a"\a&quot;\a)a::\n \x02]',
+        '[text(1,1):a![Foo](\a<\a&lt;\a/my\nuri\a>\a&gt;\a \a"\a&quot;\atesting\a"\a&quot;\a)a::\n \x02]',
         "[end-setext::]",
     ]
     expected_gfm = """<h2>a![Foo](&lt;/my\nuri&gt; &quot;testing&quot;)a</h2>"""
diff --git a/test/gfm/test_markdown_strikethrough_extension.py b/test/gfm/test_markdown_strikethrough_extension.py
index acbd02af..f42e5610 100644
--- a/test/gfm/test_markdown_strikethrough_extension.py
+++ b/test/gfm/test_markdown_strikethrough_extension.py
@@ -63,15 +63,11 @@ def test_strikethrough_492_x():
 new paragraph~~."""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):This :]",
-        "[text(1,6):~~:]",
-        "[text(1,8):has a:]",
+        "[text(1,1):This ~~has a:]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):new paragraph:]",
-        "[text(3,14):~~:]",
-        "[text(3,16):.:]",
+        "[text(3,1):new paragraph~~.:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>This ~~has a</p>\n<p>new paragraph~~.</p>"""
@@ -115,11 +111,7 @@ def test_strikethrough_493_x():
     source_markdown = """This will ~~~not~~~ strike."""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):This will :]",
-        "[text(1,11):~~~:]",
-        "[text(1,14):not:]",
-        "[text(1,17):~~~:]",
-        "[text(1,20): strike.:]",
+        "[text(1,1):This will ~~~not~~~ strike.:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>This will ~~~not~~~ strike.</p>"""
@@ -157,11 +149,7 @@ def test_strikethrough_493_b():
     source_markdown = """This will ~~~not~~ strike."""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):This will :]",
-        "[text(1,11):~~~:]",
-        "[text(1,14):not:]",
-        "[text(1,17):~~:]",
-        "[text(1,19): strike.:]",
+        "[text(1,1):This will ~~~not~~ strike.:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>This will ~~~not~~ strike.</p>"""
diff --git a/test/gfm/test_markdown_task_list_items.py b/test/gfm/test_markdown_task_list_items.py
index 21aa0134..70fde05b 100644
--- a/test/gfm/test_markdown_task_list_items.py
+++ b/test/gfm/test_markdown_task_list_items.py
@@ -18,17 +18,11 @@ def test_task_list_items_279_x():
     expected_tokens = [
         "[ulist(1,1):-::2:]",
         "[para(1,3):]",
-        "[text(1,3):[:]",
-        "[text(1,4): :]",
-        "[text(1,5):]:]",
-        "[text(1,6): foo:]",
+        "[text(1,3):[ ] foo:]",
         "[end-para:::True]",
         "[li(2,1):2::]",
         "[para(2,3):]",
-        "[text(2,3):[:]",
-        "[text(2,4):x:]",
-        "[text(2,5):]:]",
-        "[text(2,6): bar:]",
+        "[text(2,3):[x] bar:]",
         "[end-para:::True]",
         "[end-ulist:::True]",
     ]
@@ -83,10 +77,7 @@ def test_task_list_items_279_b():
         "[end-para:::True]",
         "[li(2,1):2::]",
         "[para(2,3):]",
-        "[text(2,3):[:]",
-        "[text(2,4):y:]",
-        "[text(2,5):]:]",
-        "[text(2,6): bar:]",
+        "[text(2,3):[y] bar:]",
         "[end-para:::True]",
         "[end-ulist:::True]",
     ]
@@ -117,10 +108,7 @@ def test_task_list_items_279_c():
         "[end-para:::True]",
         "[li(2,1):2::]",
         "[para(2,3):]",
-        "[text(2,3):[:]",
-        "[text(2,4):xx:]",
-        "[text(2,6):]:]",
-        "[text(2,7): bar:]",
+        "[text(2,3):[xx] bar:]",
         "[end-para:::True]",
         "[end-ulist:::True]",
     ]
@@ -151,10 +139,7 @@ def test_task_list_items_279_d():
         "[end-para:::True]",
         "[li(2,1):2::]",
         "[para(2,3):]",
-        "[text(2,3):[:]",
-        "[text(2,4):x:]",
-        "[text(2,5):]:]",
-        "[text(2,6):bar:]",
+        "[text(2,3):[x]bar:]",
         "[end-para:::True]",
         "[end-ulist:::True]",
     ]
@@ -185,11 +170,7 @@ def test_task_list_items_279_e():
         "[end-para:::True]",
         "[li(2,1):2::]",
         "[para(2,3):]",
-        "[text(2,3):a :]",
-        "[text(2,5):[:]",
-        "[text(2,6):x:]",
-        "[text(2,7):]:]",
-        "[text(2,8):bar:]",
+        "[text(2,3):a [x]bar:]",
         "[end-para:::True]",
         "[end-ulist:::True]",
     ]
@@ -215,14 +196,7 @@ def test_task_list_items_279_f():
     expected_tokens = [
         "[block-quote(1,1)::> \n> ]",
         "[para(1,3):\n]",
-        "[text(1,3):[:]",
-        "[text(1,4): :]",
-        "[text(1,5):]:]",
-        "[text(1,6): foo\na ::\n]",
-        "[text(2,5):[:]",
-        "[text(2,6):x:]",
-        "[text(2,7):]:]",
-        "[text(2,8):bar:]",
+        "[text(1,3):[ ] foo\na [x]bar::\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -250,32 +224,20 @@ def test_task_list_items_280_x():
     expected_tokens = [
         "[ulist(1,1):-::2:]",
         "[para(1,3):]",
-        "[text(1,3):[:]",
-        "[text(1,4):x:]",
-        "[text(1,5):]:]",
-        "[text(1,6): foo:]",
+        "[text(1,3):[x] foo:]",
         "[end-para:::True]",
         "[ulist(2,3):-::4:  ]",
         "[para(2,5):]",
-        "[text(2,5):[:]",
-        "[text(2,6): :]",
-        "[text(2,7):]:]",
-        "[text(2,8): bar:]",
+        "[text(2,5):[ ] bar:]",
         "[end-para:::True]",
         "[li(3,3):4:  :]",
         "[para(3,5):]",
-        "[text(3,5):[:]",
-        "[text(3,6):x:]",
-        "[text(3,7):]:]",
-        "[text(3,8): baz:]",
+        "[text(3,5):[x] baz:]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[li(4,1):2::]",
         "[para(4,3):]",
-        "[text(4,3):[:]",
-        "[text(4,4): :]",
-        "[text(4,5):]:]",
-        "[text(4,6): bim:]",
+        "[text(4,3):[ ] bim:]",
         "[end-para:::True]",
         "[end-ulist:::True]",
     ]
@@ -367,10 +329,7 @@ def test_task_list_items_280_b():
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[para(4,5):]",
-        "[text(4,5):[:]",
-        "[text(4,6):x:]",
-        "[text(4,7):]:]",
-        "[text(4,8): baz:]",
+        "[text(4,5):[x] baz:]",
         "[end-para:::True]",
         "[BLANK(5,1):]",
         "[end-ulist:::True]",
diff --git a/test/gfm/test_markdown_textual_content_extra.py b/test/gfm/test_markdown_textual_content_extra.py
index 96a29a02..70db9ae6 100644
--- a/test/gfm/test_markdown_textual_content_extra.py
+++ b/test/gfm/test_markdown_textual_content_extra.py
@@ -268,10 +268,7 @@ def test_textual_content_extra_14():
     source_markdown = """[foo\bbar](/bar\b "ti\btle")"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foo\x05\bbar:]",
-        "[text(1,9):]:]",
-        '[text(1,10):(/bar\x05\b \a"\a&quot;\ati\x05\btle\a"\a&quot;\a):]',
+        '[text(1,1):[foo\x05\bbar](/bar\x05\b \a"\a&quot;\ati\x05\btle\a"\a&quot;\a):]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[foo\bbar](/bar\b &quot;ti\btle&quot;)</p>"""
@@ -311,10 +308,7 @@ def test_textual_content_extra_16():
     source_markdown = """[foobar](/b\bar "title")"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):[:]",
-        "[text(1,2):foobar:]",
-        "[text(1,8):]:]",
-        '[text(1,9):(/b\x05\bar \a"\a&quot;\atitle\a"\a&quot;\a):]',
+        '[text(1,1):[foobar](/b\x05\bar \a"\a&quot;\atitle\a"\a&quot;\a):]',
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[foobar](/b\bar &quot;title&quot;)</p>"""
diff --git a/test/gfm/test_markdown_thematic_breaks.py b/test/gfm/test_markdown_thematic_breaks.py
index 14b268df..be082090 100644
--- a/test/gfm/test_markdown_thematic_breaks.py
+++ b/test/gfm/test_markdown_thematic_breaks.py
@@ -72,10 +72,7 @@ def test_thematic_breaks_016():
 __"""
     expected_tokens = [
         "[para(1,1):\n\n]",
-        "[text(1,1):--\n::\n]",
-        "[text(2,1):**:]",
-        "[text(2,3):\n::\n]",
-        "[text(3,1):__:]",
+        "[text(1,1):--\n**\n__::\n\n]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>--
@@ -140,8 +137,7 @@ def test_thematic_breaks_019():
     ***"""
     expected_tokens = [
         "[para(1,1):\n    ]",
-        "[text(1,1):Foo\n::\n]",
-        "[text(2,5):***:]",
+        "[text(1,1):Foo\n***::\n]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>Foo
@@ -240,14 +236,7 @@ a------
 ---a---"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):_:]",
-        "[text(1,2): :]",
-        "[text(1,3):_:]",
-        "[text(1,4): :]",
-        "[text(1,5):_:]",
-        "[text(1,6): :]",
-        "[text(1,7):_:]",
-        "[text(1,8): a:]",
+        "[text(1,1):_ _ _ _ a:]",
         "[end-para:::True]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
diff --git a/test/gfm/test_markdown_whitespace_emphasis.py b/test/gfm/test_markdown_whitespace_emphasis.py
index 5eaaea7b..3f0ebaa1 100644
--- a/test/gfm/test_markdown_whitespace_emphasis.py
+++ b/test/gfm/test_markdown_whitespace_emphasis.py
@@ -57,13 +57,7 @@ def test_whitespaces_emphasis_1a():
 
     # Arrange
     source_markdown = """*\u00a0*"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):*:]",
-        "[text(1,2):\u00a0:]",
-        "[text(1,3):*:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):*\u00a0*:]", "[end-para:::True]"]
     expected_gfm = """<p>*\u00a0*</p>"""
 
     # Act & Assert
@@ -78,13 +72,7 @@ def test_whitespaces_emphasis_1ax():
 
     # Arrange
     source_markdown = """**\u00a0**"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):**:]",
-        "[text(1,3):\u00a0:]",
-        "[text(1,4):**:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):**\u00a0**:]", "[end-para:::True]"]
     expected_gfm = """<p>**\u00a0**</p>"""
 
     # Act & Assert
@@ -99,13 +87,7 @@ def test_whitespaces_emphasis_1b():
 
     # Arrange
     source_markdown = """_ _"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):_:]",
-        "[text(1,2): :]",
-        "[text(1,3):_:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):_ _:]", "[end-para:::True]"]
     expected_gfm = """<p>_ _</p>"""
 
     # Act & Assert
@@ -135,13 +117,7 @@ def test_whitespaces_emphasis_1c():
 
     # Arrange
     source_markdown = """_\u00a0_"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):_:]",
-        "[text(1,2):\u00a0:]",
-        "[text(1,3):_:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):_\u00a0_:]", "[end-para:::True]"]
     expected_gfm = """<p>_\u00a0_</p>"""
 
     # Act & Assert
@@ -156,13 +132,7 @@ def test_whitespaces_emphasis_1cx():
 
     # Arrange
     source_markdown = """__\u00a0__"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):__:]",
-        "[text(1,3):\u00a0:]",
-        "[text(1,4):__:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):__\u00a0__:]", "[end-para:::True]"]
     expected_gfm = """<p>__\u00a0__</p>"""
 
     # Act & Assert
@@ -177,13 +147,7 @@ def test_whitespaces_emphasis_1d():
 
     # Arrange
     source_markdown = """*\u2000*"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):*:]",
-        "[text(1,2):\u2000:]",
-        "[text(1,3):*:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):*\u2000*:]", "[end-para:::True]"]
     expected_gfm = """<p>*\u2000*</p>"""
 
     # Act & Assert
@@ -198,13 +162,7 @@ def test_whitespaces_emphasis_1dx():
 
     # Arrange
     source_markdown = """**\u2000**"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):**:]",
-        "[text(1,3):\u2000:]",
-        "[text(1,4):**:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):**\u2000**:]", "[end-para:::True]"]
     expected_gfm = """<p>**\u2000**</p>"""
 
     # Act & Assert
@@ -219,13 +177,7 @@ def test_whitespaces_emphasis_1e():
 
     # Arrange
     source_markdown = """_\u2000_"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):_:]",
-        "[text(1,2):\u2000:]",
-        "[text(1,3):_:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):_\u2000_:]", "[end-para:::True]"]
     expected_gfm = """<p>_\u2000_</p>"""
 
     # Act & Assert
@@ -240,13 +192,7 @@ def test_whitespaces_emphasis_1ex():
 
     # Arrange
     source_markdown = """__\u2000__"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):__:]",
-        "[text(1,3):\u2000:]",
-        "[text(1,4):__:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):__\u2000__:]", "[end-para:::True]"]
     expected_gfm = """<p>__\u2000__</p>"""
 
     # Act & Assert
@@ -1141,15 +1087,7 @@ def test_whitespaces_emphasis_6x():
 
     # Arrange
     source_markdown = """a*.foo.*.a"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):*:]",
-        "[text(1,3):.foo.:]",
-        "[text(1,8):*:]",
-        "[text(1,9):.a:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):a*.foo.*.a:]", "[end-para:::True]"]
     expected_gfm = """<p>a*.foo.*.a</p>"""
 
     # Act & Assert
@@ -1164,15 +1102,7 @@ def test_whitespaces_emphasis_6xx():
 
     # Arrange
     source_markdown = """a**.foo.**.a"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):**:]",
-        "[text(1,4):.foo.:]",
-        "[text(1,9):**:]",
-        "[text(1,11):.a:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):a**.foo.**.a:]", "[end-para:::True]"]
     expected_gfm = """<p>a**.foo.**.a</p>"""
 
     # Act & Assert
@@ -1187,15 +1117,7 @@ def test_whitespaces_emphasis_6a():
 
     # Arrange
     source_markdown = """a*\u007efoo\u007e*a"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):*:]",
-        "[text(1,3):~foo~:]",
-        "[text(1,8):*:]",
-        "[text(1,9):a:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):a*~foo~*a:]", "[end-para:::True]"]
     expected_gfm = """<p>a*~foo~*a</p>"""
 
     # Act & Assert
@@ -1210,15 +1132,7 @@ def test_whitespaces_emphasis_6ax():
 
     # Arrange
     source_markdown = """a**\u007efoo\u007e**a"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):**:]",
-        "[text(1,4):~foo~:]",
-        "[text(1,9):**:]",
-        "[text(1,11):a:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):a**~foo~**a:]", "[end-para:::True]"]
     expected_gfm = """<p>a**~foo~**a</p>"""
 
     # Act & Assert
@@ -1233,15 +1147,7 @@ def test_whitespaces_emphasis_6b():
 
     # Arrange
     source_markdown = """a_.foo._.a"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):_:]",
-        "[text(1,3):.foo.:]",
-        "[text(1,8):_:]",
-        "[text(1,9):.a:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):a_.foo._.a:]", "[end-para:::True]"]
     expected_gfm = """<p>a_.foo._.a</p>"""
 
     # Act & Assert
@@ -1256,15 +1162,7 @@ def test_whitespaces_emphasis_6bx():
 
     # Arrange
     source_markdown = """a__.foo.__.a"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):__:]",
-        "[text(1,4):.foo.:]",
-        "[text(1,9):__:]",
-        "[text(1,11):.a:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):a__.foo.__.a:]", "[end-para:::True]"]
     expected_gfm = """<p>a__.foo.__.a</p>"""
 
     # Act & Assert
@@ -1279,15 +1177,7 @@ def test_whitespaces_emphasis_6c():
 
     # Arrange
     source_markdown = """a_\u007efoo\u007e_a"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):_:]",
-        "[text(1,3):~foo~:]",
-        "[text(1,8):_:]",
-        "[text(1,9):a:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):a_~foo~_a:]", "[end-para:::True]"]
     expected_gfm = """<p>a_~foo~_a</p>"""
 
     # Act & Assert
@@ -1302,15 +1192,7 @@ def test_whitespaces_emphasis_6cx():
 
     # Arrange
     source_markdown = """a__\u007efoo\u007e__a"""
-    expected_tokens = [
-        "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):__:]",
-        "[text(1,4):~foo~:]",
-        "[text(1,9):__:]",
-        "[text(1,11):a:]",
-        "[end-para:::True]",
-    ]
+    expected_tokens = ["[para(1,1):]", "[text(1,1):a__~foo~__a:]", "[end-para:::True]"]
     expected_gfm = """<p>a__~foo~__a</p>"""
 
     # Act & Assert
@@ -1327,11 +1209,7 @@ def test_whitespaces_emphasis_6d():
     source_markdown = """a*\u203ffoo\u203f*a"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):*:]",
-        "[text(1,3):‿foo‿:]",
-        "[text(1,8):*:]",
-        "[text(1,9):a:]",
+        "[text(1,1):a*\u203ffoo\u203f*a:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a*\u203ffoo\u203f*a</p>"""
@@ -1350,11 +1228,7 @@ def test_whitespaces_emphasis_6dx():
     source_markdown = """a**\u203ffoo\u203f**a"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):**:]",
-        "[text(1,4):‿foo‿:]",
-        "[text(1,9):**:]",
-        "[text(1,11):a:]",
+        "[text(1,1):a**\u203ffoo\u203f**a:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a**\u203ffoo\u203f**a</p>"""
@@ -1373,11 +1247,7 @@ def test_whitespaces_emphasis_6e():
     source_markdown = """a_\u203ffoo\u203f_a"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):_:]",
-        "[text(1,3):‿foo‿:]",
-        "[text(1,8):_:]",
-        "[text(1,9):a:]",
+        "[text(1,1):a_\u203ffoo\u203f_a:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a_\u203ffoo\u203f_a</p>"""
@@ -1396,11 +1266,7 @@ def test_whitespaces_emphasis_6ex():
     source_markdown = """a__\u203ffoo\u203f__a"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):__:]",
-        "[text(1,4):‿foo‿:]",
-        "[text(1,9):__:]",
-        "[text(1,11):a:]",
+        "[text(1,1):a__\u203ffoo\u203f__a:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a__\u203ffoo\u203f__a</p>"""
diff --git a/test/gfm/test_markdown_whitespace_html.py b/test/gfm/test_markdown_whitespace_html.py
index 96fc792c..fe882354 100644
--- a/test/gfm/test_markdown_whitespace_html.py
+++ b/test/gfm/test_markdown_whitespace_html.py
@@ -1969,12 +1969,7 @@ def test_whitespaces_html_with_tabs_before_within_block_quotes_x2():
     expected_tokens = [
         "[block-quote(1,1)::> \n> \n]",
         "[para(1,3):\n\n  \t]",
-        "[text(1,3):abc\ndef\n::\n\n]",
-        "[text(3,4):*:]",
-        "[text(3,5): :]",
-        "[text(3,6):*:]",
-        "[text(3,7): :]",
-        "[text(3,8):*:]",
+        "[text(1,3):abc\ndef\n* * *::\n\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
diff --git a/test/gfm/test_markdown_whitespace_link_reference_definition.py b/test/gfm/test_markdown_whitespace_link_reference_definition.py
index 74a26bdd..7e5b5f4f 100644
--- a/test/gfm/test_markdown_whitespace_link_reference_definition.py
+++ b/test/gfm/test_markdown_whitespace_link_reference_definition.py
@@ -41,14 +41,7 @@ def test_whitespaces_lrd_with_too_many_spaces_before():
     [fred]: /url"""
     expected_tokens = [
         "[para(1,1):\n    ]",
-        "[text(1,1):[:]",
-        "[text(1,2):fred:]",
-        "[text(1,6):]:]",
-        "[text(1,7):\n::\n]",
-        "[text(2,5):[:]",
-        "[text(2,6):fred:]",
-        "[text(2,10):]:]",
-        "[text(2,11):: /url:]",
+        "[text(1,1):[fred]\n[fred]: /url::\n]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[fred]
@@ -72,9 +65,7 @@ def test_whitespaces_lrd_with_tabs_before():
         "[text(1,5):[fred]: /url:]",
         "[end-icode-block:::False]",
         "[para(2,1):]",
-        "[text(2,1):[:]",
-        "[text(2,2):fred:]",
-        "[text(2,6):]:]",
+        "[text(2,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<pre><code>[fred]: /url
@@ -101,13 +92,7 @@ def test_whitespaces_lrd_with_tabs_before_repeat():
         "[text(1,5):[abc]: /url\n[def]: /url:]",
         "[end-icode-block:::False]",
         "[para(3,1):\n]",
-        "[text(3,1):[:]",
-        "[text(3,2):abc:]",
-        "[text(3,5):]:]",
-        "[text(3,6):\n::\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):def:]",
-        "[text(4,5):]:]",
+        "[text(3,1):[abc]\n[def]::\n]",
         "[end-para:::True]",
     ]
     expected_gfm = """<pre><code>[abc]: /url
@@ -131,13 +116,7 @@ def test_whitespaces_lrd_with_form_feeds_before():
 [fred]"""
     expected_tokens = [
         "[para(1,1):\u000c\n]",
-        "[text(1,1):[:]",
-        "[text(1,2):fred:]",
-        "[text(1,6):]:]",
-        "[text(1,7):: /url\n::\n]",
-        "[text(2,1):[:]",
-        "[text(2,2):fred:]",
-        "[text(2,6):]:]",
+        "[text(1,1):[fred]: /url\n[fred]::\n]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>[fred]: /url
@@ -160,14 +139,7 @@ def test_whitespaces_lrd_with_spaces_before_within_list():
     expected_tokens = [
         "[ulist(1,1):-::2::  \n]",
         "[para(1,3):\n  \n]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,3):[:]",
-        "[text(2,4):fred:]",
-        "[text(2,8):]:]",
-        "[text(2,9):: /url\n::\n]",
-        "[text(3,1):[:]",
-        "[text(3,2):fred:]",
-        "[text(3,6):]:]",
+        "[text(1,3):abc\n[fred]: /url\n[fred]::\n\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
     ]
@@ -195,14 +167,7 @@ def test_whitespaces_lrd_with_spaces_before_within_block_quotes():
     expected_tokens = [
         "[block-quote(1,1)::> \n> \n\n]",
         "[para(1,3):\n\n    \n]",
-        "[text(1,3):abc\ndef\n::\n\n]",
-        "[text(3,5):[:]",
-        "[text(3,6):fred:]",
-        "[text(3,10):]:]",
-        "[text(3,11):: /url\n::\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(1,3):abc\ndef\n[fred]: /url\n[fred]::\n\n\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -235,14 +200,7 @@ def test_whitespaces_lrd_with_spaces_before_within_double_block_quotes():
         "[end-para:::True]",
         "[block-quote(2,1)::> > \n\n]",
         "[para(2,5):\n    \n]",
-        "[text(2,5):def\n::\n]",
-        "[text(3,5):[:]",
-        "[text(3,6):fred:]",
-        "[text(3,10):]:]",
-        "[text(3,11):: /url\n::\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(2,5):def\n[fred]: /url\n[fred]::\n\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-block-quote:::True]",
@@ -278,14 +236,7 @@ def test_whitespaces_lrd_with_spaces_before_within_double_block_quote_with_singl
         "[end-para:::True]",
         "[block-quote(2,1)::> > \n> \n]",
         "[para(2,5):\n  \n]",
-        "[text(2,5):def\n::\n]",
-        "[text(3,5):[:]",
-        "[text(3,6):fred:]",
-        "[text(3,10):]:]",
-        "[text(3,11):: /url\n::\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(2,5):def\n[fred]: /url\n[fred]::\n\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-block-quote:::True]",
@@ -317,18 +268,12 @@ def test_whitespaces_lrd_with_tabs_before_within_unordered_list_x():
     expected_tokens = [
         "[ulist(1,1):-::2::\n]",
         "[para(1,3):\n\t]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,2):[:]",
-        "[text(2,3):fred:]",
-        "[text(2,7):]:]",
-        "[text(2,8):: /url:]",
+        "[text(1,3):abc\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[end-ulist:::True]",
         "[para(4,1):]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(4,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<ul>
@@ -355,18 +300,12 @@ def test_whitespaces_lrd_with_tabs_before_within_unordered_list_and_single_space
     expected_tokens = [
         "[ulist(1,1):-::2:: \n]",
         "[para(1,3):\n\t]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,2):[:]",
-        "[text(2,3):fred:]",
-        "[text(2,7):]:]",
-        "[text(2,8):: /url:]",
+        "[text(1,3):abc\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[end-ulist:::True]",
         "[para(4,1):]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(4,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<ul>
@@ -393,18 +332,12 @@ def test_whitespaces_lrd_with_tabs_before_within_unordered_list_and_spaces():
     expected_tokens = [
         "[ulist(1,1):-::2::  \n]",
         "[para(1,3):\n\t]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,2):[:]",
-        "[text(2,3):fred:]",
-        "[text(2,7):]:]",
-        "[text(2,8):: /url:]",
+        "[text(1,3):abc\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[end-ulist:::True]",
         "[para(4,1):]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(4,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<ul>
@@ -436,19 +369,13 @@ def test_whitespaces_lrd_with_tabs_before_within_unordered_double_list():
         "[end-para:::True]",
         "[ulist(2,3):-::4:  :\t\n]",
         "[para(2,5):\n]",
-        "[text(2,5):def\n::\n]",
-        "[text(3,1):[:]",
-        "[text(3,2):fred:]",
-        "[text(3,6):]:]",
-        "[text(3,7):: /url:]",
+        "[text(2,5):def\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[BLANK(4,1):]",
         "[end-ulist:::True]",
         "[end-ulist:::True]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):fred:]",
-        "[text(5,6):]:]",
+        "[text(5,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<ul>
@@ -479,18 +406,12 @@ def test_whitespaces_lrd_with_tabs_before_within_ordered_list_x():
     expected_tokens = [
         "[olist(1,1):.:1:3::\n]",
         "[para(1,4):\n\t]",
-        "[text(1,4):abc\n::\n]",
-        "[text(2,2):[:]",
-        "[text(2,3):fred:]",
-        "[text(2,7):]:]",
-        "[text(2,8):: /url:]",
+        "[text(1,4):abc\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[end-olist:::True]",
         "[para(4,1):]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(4,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<ol>
@@ -517,18 +438,12 @@ def test_whitespaces_lrd_with_spaces_before_within_ordered_list():
     expected_tokens = [
         "[olist(1,1):.:1:3::   \n]",
         "[para(1,4):\n ]",
-        "[text(1,4):abc\n::\n]",
-        "[text(2,2):[:]",
-        "[text(2,3):fred:]",
-        "[text(2,7):]:]",
-        "[text(2,8):: /url:]",
+        "[text(1,4):abc\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[end-olist:::True]",
         "[para(4,1):]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(4,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<ol>
@@ -555,18 +470,12 @@ def test_whitespaces_lrd_with_tabs_before_within_ordered_list_and_single_space()
     expected_tokens = [
         "[olist(1,1):.:1:3:: \n]",
         "[para(1,4):\n\t]",
-        "[text(1,4):abc\n::\n]",
-        "[text(2,2):[:]",
-        "[text(2,3):fred:]",
-        "[text(2,7):]:]",
-        "[text(2,8):: /url:]",
+        "[text(1,4):abc\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[end-olist:::True]",
         "[para(4,1):]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(4,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<ol>
@@ -593,18 +502,12 @@ def test_whitespaces_lrd_with_tabs_before_within_ordered_list_and_spaces():
     expected_tokens = [
         "[olist(1,1):.:1:3::  \n]",
         "[para(1,4):\n\t]",
-        "[text(1,4):abc\n::\n]",
-        "[text(2,2):[:]",
-        "[text(2,3):fred:]",
-        "[text(2,7):]:]",
-        "[text(2,8):: /url:]",
+        "[text(1,4):abc\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[end-olist:::True]",
         "[para(4,1):]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(4,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<ol>
@@ -636,19 +539,13 @@ def test_whitespaces_lrd_with_tabs_before_within_ordered_double_list_x():
         "[end-para:::True]",
         "[olist(2,4):.:1:6:   :\t  \n]",
         "[para(2,7):\n]",
-        "[text(2,7):def\n::\n]",
-        "[text(3,1):[:]",
-        "[text(3,2):fred:]",
-        "[text(3,6):]:]",
-        "[text(3,7):: /url:]",
+        "[text(2,7):def\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[BLANK(4,1):]",
         "[end-olist:::True]",
         "[end-olist:::True]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):fred:]",
-        "[text(5,6):]:]",
+        "[text(5,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<ol>
@@ -684,19 +581,13 @@ def test_whitespaces_lrd_with_tabs_before_within_ordered_double_list_no_spaces()
         "[end-para:::True]",
         "[olist(2,4):.:1:6:   :\n]",
         "[para(2,7):\n\t]",
-        "[text(2,7):def\n::\n]",
-        "[text(3,2):[:]",
-        "[text(3,3):fred:]",
-        "[text(3,7):]:]",
-        "[text(3,8):: /url:]",
+        "[text(2,7):def\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[BLANK(4,1):]",
         "[end-olist:::True]",
         "[end-olist:::True]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):fred:]",
-        "[text(5,6):]:]",
+        "[text(5,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<ol>
@@ -732,19 +623,13 @@ def test_whitespaces_lrd_with_tabs_before_within_ordered_double_list_tab_after_i
         "[end-para:::True]",
         "[olist(2,4):.:1:6:   :\n]",
         "[para(2,7):\n   \t:\t]",
-        "[text(2,7):def\n::\n]",
-        "[text(3,5):[:]",
-        "[text(3,6):fred:]",
-        "[text(3,10):]:]",
-        "[text(3,11)::\t/url:]",
+        "[text(2,7):def\n[fred]:\t/url::\n]",
         "[end-para:::True]",
         "[BLANK(4,1):]",
         "[end-olist:::True]",
         "[end-olist:::True]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):fred:]",
-        "[text(5,6):]:]",
+        "[text(5,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<ol>
@@ -780,19 +665,13 @@ def test_whitespaces_lrd_with_tabs_before_within_ordered_double_list_one_space()
         "[end-para:::True]",
         "[olist(2,4):.:1:6:   :\n]",
         "[para(2,7):\n\t ]",
-        "[text(2,7):def\n::\n]",
-        "[text(3,3):[:]",
-        "[text(3,4):fred:]",
-        "[text(3,8):]:]",
-        "[text(3,9):: /url:]",
+        "[text(2,7):def\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[BLANK(4,1):]",
         "[end-olist:::True]",
         "[end-olist:::True]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):fred:]",
-        "[text(5,6):]:]",
+        "[text(5,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<ol>
@@ -828,19 +707,13 @@ def test_whitespaces_lrd_with_tabs_before_within_ordered_double_list_only_spaces
         "[end-para:::True]",
         "[olist(2,4):.:1:6:   :\n]",
         "[para(2,7):\n    ]",
-        "[text(2,7):def\n::\n]",
-        "[text(3,5):[:]",
-        "[text(3,6):fred:]",
-        "[text(3,10):]:]",
-        "[text(3,11):: /url:]",
+        "[text(2,7):def\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[BLANK(4,1):]",
         "[end-olist:::True]",
         "[end-olist:::True]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):fred:]",
-        "[text(5,6):]:]",
+        "[text(5,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<ol>
@@ -871,18 +744,12 @@ def test_whitespaces_lrd_with_formfeeds_before_within_list():
     expected_tokens = [
         "[ulist(1,1):-::2::\n]",
         "[para(1,3):\n ]",
-        "[text(1,3):abc\n\u000C \u000C::\n]",
-        "[text(2,5):[:]",
-        "[text(2,6):fred:]",
-        "[text(2,10):]:]",
-        "[text(2,11):: /url:]",
+        "[text(1,3):abc\n\u000C \u000C[fred]: /url::\n]",
         "[end-para:::True]",
         "[BLANK(3,1):]",
         "[end-ulist:::True]",
         "[para(4,1):]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(4,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<ul>
@@ -914,19 +781,13 @@ def test_whitespaces_lrd_with_spaces_before_within_double_block_quotes_with_zero
         "[end-para:::True]",
         "[block-quote(2,1)::> > \n\n]",
         "[para(2,5):\n]",
-        "[text(2,5):def\n::\n]",
-        "[text(3,1):[:]",
-        "[text(3,2):fred:]",
-        "[text(3,6):]:]",
-        "[text(3,7):: /url:]",
+        "[text(2,5):def\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-block-quote:::True]",
         "[BLANK(4,1):]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):fred:]",
-        "[text(5,6):]:]",
+        "[text(5,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<blockquote>
@@ -961,19 +822,13 @@ def test_whitespaces_lrd_with_spaces_before_within_double_block_quotes_with_zero
         "[end-para:::True]",
         "[block-quote(2,1)::> > \n\n]",
         "[para(2,5):\n ]",
-        "[text(2,5):def\n::\n]",
-        "[text(3,2):[:]",
-        "[text(3,3):fred:]",
-        "[text(3,7):]:]",
-        "[text(3,8):: /url:]",
+        "[text(2,5):def\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-block-quote:::True]",
         "[BLANK(4,1):]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):fred:]",
-        "[text(5,6):]:]",
+        "[text(5,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<blockquote>
@@ -1008,19 +863,13 @@ def test_whitespaces_lrd_with_spaces_before_within_double_block_quotes_with_zero
         "[end-para:::True]",
         "[block-quote(2,1)::> > \n\n]",
         "[para(2,5):\n  ]",
-        "[text(2,5):def\n::\n]",
-        "[text(3,3):[:]",
-        "[text(3,4):fred:]",
-        "[text(3,8):]:]",
-        "[text(3,9):: /url:]",
+        "[text(2,5):def\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-block-quote:::True]",
         "[BLANK(4,1):]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):fred:]",
-        "[text(5,6):]:]",
+        "[text(5,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<blockquote>
@@ -1055,19 +904,13 @@ def test_whitespaces_lrd_with_spaces_before_within_double_block_quotes_with_zero
         "[end-para:::True]",
         "[block-quote(2,1)::> > \n\n]",
         "[para(2,5):\n   ]",
-        "[text(2,5):def\n::\n]",
-        "[text(3,4):[:]",
-        "[text(3,5):fred:]",
-        "[text(3,9):]:]",
-        "[text(3,10):: /url:]",
+        "[text(2,5):def\n[fred]: /url::\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-block-quote:::True]",
         "[BLANK(4,1):]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):fred:]",
-        "[text(5,6):]:]",
+        "[text(5,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<blockquote>
@@ -1106,14 +949,7 @@ def test_whitespaces_lrd_with_tabs_before_within_block_quotes_x1():
     expected_tokens = [
         "[block-quote(1,1)::> \n> \n\n]",
         "[para(1,3):\n\n\t\n]",
-        "[text(1,3):abc\ndef\n::\n\n]",
-        "[text(3,2):[:]",
-        "[text(3,3):fred:]",
-        "[text(3,7):]:]",
-        "[text(3,8):: /url\n::\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(1,3):abc\ndef\n[fred]: /url\n[fred]::\n\n\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -1143,18 +979,12 @@ def test_whitespaces_lrd_with_tabs_before_within_block_quotes_x2():
     expected_tokens = [
         "[block-quote(1,1)::> \n> \n\n]",
         "[para(1,3):\n\n  \t]",
-        "[text(1,3):abc\ndef\n::\n\n]",
-        "[text(3,4):[:]",
-        "[text(3,5):fred:]",
-        "[text(3,9):]:]",
-        "[text(3,10):: /url:]",
+        "[text(1,3):abc\ndef\n[fred]: /url::\n\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[BLANK(4,1):]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):fred:]",
-        "[text(5,6):]:]",
+        "[text(5,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<blockquote>
@@ -1185,26 +1015,12 @@ def test_whitespaces_lrd_with_tabs_before_within_block_quotes_repeat():
     expected_tokens = [
         "[block-quote(1,1)::> \n> \n>\n>\n]",
         "[para(1,3):\n\n\t\n\t]",
-        "[text(1,3):abc\ndef\n::\n\n]",
-        "[text(3,3):[:]",
-        "[text(3,4):fred:]",
-        "[text(3,8):]:]",
-        "[text(3,9):: /url1\n::\n]",
-        "[text(4,3):[:]",
-        "[text(4,4):barney:]",
-        "[text(4,10):]:]",
-        "[text(4,11):: /url2:]",
+        "[text(1,3):abc\ndef\n[fred]: /url1\n[barney]: /url2::\n\n\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[BLANK(5,1):]",
         "[para(6,1):\n]",
-        "[text(6,1):[:]",
-        "[text(6,2):fred:]",
-        "[text(6,6):]:]",
-        "[text(6,7):\n::\n]",
-        "[text(7,1):[:]",
-        "[text(7,2):barney:]",
-        "[text(7,8):]:]",
+        "[text(6,1):[fred]\n[barney]::\n]",
         "[end-para:::True]",
     ]
     expected_gfm = """<blockquote>
@@ -1342,14 +1158,7 @@ def test_whitespaces_lrd_with_spaces_before_within_block_quote_just_enough():
     expected_tokens = [
         "[block-quote(1,1)::> \n> \n\n]",
         "[para(1,3):\n\n   \n]",
-        "[text(1,3):abc\ndef\n::\n\n]",
-        "[text(3,4):[:]",
-        "[text(3,5):fred:]",
-        "[text(3,9):]:]",
-        "[text(3,10):: /url\n::\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(1,3):abc\ndef\n[fred]: /url\n[fred]::\n\n\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -1909,13 +1718,7 @@ def test_whitespaces_lrd_with_tabs_before_within_block_quotes_bare_with_space_re
     expected_tokens = [
         "[block-quote(1,1)::> \n]",
         "[para(1,5):\t\n]",
-        "[text(1,5):[:]",
-        "[text(1,6):fred:]",
-        "[text(1,10):]:]",
-        '[text(1,11)::\t/url1\t\a"\a&quot;\aabc\a"\a&quot;\adef\n::\n]',
-        "[text(2,1):[:]",
-        "[text(2,2):fred:]",
-        "[text(2,6):]:]",
+        '[text(1,5):[fred]:\t/url1\t\a"\a&quot;\aabc\a"\a&quot;\adef\n[fred]::\n]',
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -1941,17 +1744,12 @@ def test_whitespaces_lrd_with_tabs_before_within_block_quotes_bare_with_space_re
     expected_tokens = [
         "[block-quote(1,1)::> \n]",
         "[para(1,5):\t]",
-        "[text(1,5):[:]",
-        "[text(1,6):fred:]",
-        "[text(1,10):]:]",
-        '[text(1,11)::\t/url1\t\a"\a&quot;\aabc\a"\a&quot;\adef:]',
+        '[text(1,5):[fred]:\t/url1\t\a"\a&quot;\aabc\a"\a&quot;\adef:]',
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):fred:]",
-        "[text(3,6):]:]",
+        "[text(3,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<blockquote>
@@ -1975,13 +1773,7 @@ def test_whitespaces_lrd_with_tabs_before_within_block_quotes_bare_with_space_re
     expected_tokens = [
         "[block-quote(1,1)::> \n]",
         "[para(1,5):\t\n]",
-        "[text(1,5):[:]",
-        "[text(1,6):fred:]",
-        "[text(1,10):]:]",
-        '[text(1,11)::\t/url1\t\a"\a&quot;\aabc\n::\n]',
-        "[text(2,1):[:]",
-        "[text(2,2):fred:]",
-        "[text(2,6):]:]",
+        '[text(1,5):[fred]:\t/url1\t\a"\a&quot;\aabc\n[fred]::\n]',
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -2007,17 +1799,12 @@ def test_whitespaces_lrd_with_tabs_before_within_block_quotes_bare_with_space_re
     expected_tokens = [
         "[block-quote(1,1)::> \n]",
         "[para(1,5):\t]",
-        "[text(1,5):[:]",
-        "[text(1,6):fred:]",
-        "[text(1,10):]:]",
-        '[text(1,11)::\t/url1\t\a"\a&quot;\aabc:]',
+        '[text(1,5):[fred]:\t/url1\t\a"\a&quot;\aabc:]',
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):fred:]",
-        "[text(3,6):]:]",
+        "[text(3,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<blockquote>
@@ -2041,13 +1828,7 @@ def test_whitespaces_lrd_with_tabs_before_within_block_quotes_bare_with_space_re
     expected_tokens = [
         "[block-quote(1,1)::> \n]",
         "[para(1,5):\t\n]",
-        "[text(1,5):[:]",
-        "[text(1,6):fred:]",
-        "[text(1,10):]:]",
-        "[text(1,11)::\t\a<\a&lt;\a/url1\n::\n]",
-        "[text(2,1):[:]",
-        "[text(2,2):fred:]",
-        "[text(2,6):]:]",
+        "[text(1,5):[fred]:\t\a<\a&lt;\a/url1\n[fred]::\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -2073,17 +1854,12 @@ def test_whitespaces_lrd_with_tabs_before_within_block_quotes_bare_with_space_re
     expected_tokens = [
         "[block-quote(1,1)::> \n]",
         "[para(1,5):\t]",
-        "[text(1,5):[:]",
-        "[text(1,6):fred:]",
-        "[text(1,10):]:]",
-        "[text(1,11)::\t\a<\a&lt;\a/url1:]",
+        "[text(1,5):[fred]:\t\a<\a&lt;\a/url1:]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):fred:]",
-        "[text(3,6):]:]",
+        "[text(3,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<blockquote>
@@ -2107,13 +1883,7 @@ def test_whitespaces_lrd_with_tabs_before_within_block_quotes_bare_with_space_re
     expected_tokens = [
         "[block-quote(1,1)::> \n]",
         "[para(1,5):\t\n]",
-        "[text(1,5):[:]",
-        "[text(1,6):fred:]",
-        "[text(1,10):]:]",
-        "[text(1,11)::\n::\t\n]",
-        "[text(2,1):[:]",
-        "[text(2,2):fred:]",
-        "[text(2,6):]:]",
+        "[text(1,5):[fred]:\n[fred]::\t\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -2139,17 +1909,12 @@ def test_whitespaces_lrd_with_tabs_before_within_block_quotes_bare_with_space_re
     expected_tokens = [
         "[block-quote(1,1)::> \n]",
         "[para(1,5):\t:\t]",
-        "[text(1,5):[:]",
-        "[text(1,6):fred:]",
-        "[text(1,10):]:]",
-        "[text(1,11):::]",
+        "[text(1,5):[fred]::]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[BLANK(2,1):]",
         "[para(3,1):]",
-        "[text(3,1):[:]",
-        "[text(3,2):fred:]",
-        "[text(3,6):]:]",
+        "[text(3,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<blockquote>
@@ -2356,18 +2121,12 @@ def test_whitespaces_lrd_with_tabs_before_within_block_quotes_bare_over_two_line
     expected_tokens = [
         "[block-quote(1,1)::> \n>\n>\n]",
         "[para(1,3):\n\t\n\t:\t]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,3):[:]",
-        "[text(2,4):fred:]",
-        "[text(2,8):]:]",
-        "[text(2,9)::\n/url::\t\n]",
+        "[text(1,3):abc\n[fred]:\n/url::\n\t\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[BLANK(4,1):]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):fred:]",
-        "[text(5,6):]:]",
+        "[text(5,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<blockquote>
@@ -2653,17 +2412,12 @@ def test_whitespaces_lrd_with_tabs_before_within_block_quotes_bare_over_more_lin
         "[end-para:::True]",
         "[BLANK(2,2):]",
         "[para(3,5):\t\n\t\n]",
-        "[text(3,5):[:]",
-        "[text(3,6):fred:]",
-        "[text(3,10):]:]",
-        "[text(3,11)::\n\a<\a&lt;\a/url\nabc::\t\n\t\n]",
+        "[text(3,5):[fred]:\n\a<\a&lt;\a/url\nabc::\t\n\t\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[BLANK(6,1):]",
         "[para(7,1):]",
-        "[text(7,1):[:]",
-        "[text(7,2):fred:]",
-        "[text(7,6):]:]",
+        "[text(7,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<blockquote>
@@ -2697,17 +2451,12 @@ def test_whitespaces_lrd_with_tabs_before_within_block_quotes_bare_over_more_lin
         "[end-para:::True]",
         "[BLANK(2,2):]",
         "[para(3,5):\t:\t]",
-        "[text(3,5):[:]",
-        "[text(3,6):fred:]",
-        "[text(3,10):]:]",
-        "[text(3,11):::]",
+        "[text(3,5):[fred]::]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[BLANK(4,1):]",
         "[para(5,1):]",
-        "[text(5,1):[:]",
-        "[text(5,2):fred:]",
-        "[text(5,6):]:]",
+        "[text(5,1):[fred]:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<blockquote>
@@ -2738,14 +2487,7 @@ def test_whitespaces_lrd_with_tabs_before_within_double_block_quotes():
         "[end-para:::True]",
         "[block-quote(2,1)::> > \n\n]",
         "[para(2,5):\n\t\n]",
-        "[text(2,5):def\n::\n]",
-        "[text(3,2):[:]",
-        "[text(3,3):fred:]",
-        "[text(3,7):]:]",
-        "[text(3,8):: /url\n::\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(2,5):def\n[fred]: /url\n[fred]::\n\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-block-quote:::True]",
@@ -2781,14 +2523,7 @@ def test_whitespaces_lrd_with_tabs_before_within_double_block_quotes_with_single
         "[end-para:::True]",
         "[block-quote(2,1)::> > \n>\n]",
         "[para(2,5):\n\t\n]",
-        "[text(2,5):def\n::\n]",
-        "[text(3,3):[:]",
-        "[text(3,4):fred:]",
-        "[text(3,8):]:]",
-        "[text(3,9):: /url\n::\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(2,5):def\n[fred]: /url\n[fred]::\n\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-block-quote:::True]",
@@ -2824,14 +2559,7 @@ def test_whitespaces_lrd_with_tabs_before_within_double_block_quotes_with_single
         "[end-para:::True]",
         "[block-quote(2,1)::> > \n> \n]",
         "[para(2,5):\n\t\n]",
-        "[text(2,5):def\n::\n]",
-        "[text(3,4):[:]",
-        "[text(3,5):fred:]",
-        "[text(3,9):]:]",
-        "[text(3,10):: /url\n::\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):fred:]",
-        "[text(4,6):]:]",
+        "[text(2,5):def\n[fred]: /url\n[fred]::\n\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-block-quote:::True]",
diff --git a/test/gfm/test_markdown_whitespace_thematic_break.py b/test/gfm/test_markdown_whitespace_thematic_break.py
index 118ce7fd..7aa96c9a 100644
--- a/test/gfm/test_markdown_whitespace_thematic_break.py
+++ b/test/gfm/test_markdown_whitespace_thematic_break.py
@@ -95,11 +95,7 @@ def test_whitespaces_thematic_breaks_with_form_feeds_before():
     source_markdown = """ \u000C * * *"""
     expected_tokens = [
         "[para(1,2): \u000C ]",
-        "[text(1,2):*:]",
-        "[text(1,3): :]",
-        "[text(1,4):*:]",
-        "[text(1,5): :]",
-        "[text(1,6):*:]",
+        "[text(1,2):* * *:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>* * *</p>"""
@@ -148,12 +144,7 @@ def test_whitespaces_thematic_breaks_with_spaces_before_within_block_quotes():
     expected_tokens = [
         "[block-quote(1,1)::> \n> \n]",
         "[para(1,3):\n\n    ]",
-        "[text(1,3):abc\ndef\n::\n\n]",
-        "[text(3,5):*:]",
-        "[text(3,6): :]",
-        "[text(3,7):*:]",
-        "[text(3,8): :]",
-        "[text(3,9):*:]",
+        "[text(1,3):abc\ndef\n* * *::\n\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -184,12 +175,7 @@ def test_whitespaces_thematic_breaks_with_spaces_before_within_double_block_quot
         "[end-para:::True]",
         "[block-quote(2,1)::> > \n]",
         "[para(2,5):\n    ]",
-        "[text(2,5):def\n::\n]",
-        "[text(3,5):*:]",
-        "[text(3,6): :]",
-        "[text(3,7):*:]",
-        "[text(3,8): :]",
-        "[text(3,9):*:]",
+        "[text(2,5):def\n* * *::\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-block-quote:::True]",
@@ -659,12 +645,7 @@ def test_whitespaces_thematic_breaks_with_formfeeds_before_within_list():
     expected_tokens = [
         "[ulist(1,1):-::2::]",
         "[para(1,3):\n ]",
-        "[text(1,3):abc\n\u000C \u000C::\n]",
-        "[text(2,5):*:]",
-        "[text(2,6): :]",
-        "[text(2,7):*:]",
-        "[text(2,8): :]",
-        "[text(2,9):*:]",
+        "[text(1,3):abc\n\u000C \u000C* * *::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
     ]
@@ -839,12 +820,7 @@ def test_whitespaces_thematic_breaks_with_tabs_before_within_block_quotes_x1():
     expected_tokens = [
         "[block-quote(1,1)::> \n> \n]",
         "[para(1,3):\n\n\t]",
-        "[text(1,3):abc\ndef\n::\n\n]",
-        "[text(3,2):*:]",
-        "[text(3,3): :]",
-        "[text(3,4):*:]",
-        "[text(3,5): :]",
-        "[text(3,6):*:]",
+        "[text(1,3):abc\ndef\n* * *::\n\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -871,12 +847,7 @@ def test_whitespaces_thematic_breaks_with_tabs_before_within_block_quotes_x2():
     expected_tokens = [
         "[block-quote(1,1)::> \n> \n]",
         "[para(1,3):\n\n  \t]",
-        "[text(1,3):abc\ndef\n::\n\n]",
-        "[text(3,4):*:]",
-        "[text(3,5): :]",
-        "[text(3,6):*:]",
-        "[text(3,7): :]",
-        "[text(3,8):*:]",
+        "[text(1,3):abc\ndef\n* * *::\n\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
     ]
@@ -1013,12 +984,7 @@ def test_whitespaces_thematic_breaks_with_tabs_before_within_double_block_quotes
         "[end-para:::True]",
         "[block-quote(2,1)::> > \n]",
         "[para(2,5):\n\t]",
-        "[text(2,5):def\n::\n]",
-        "[text(3,2):*:]",
-        "[text(3,3): :]",
-        "[text(3,4):*:]",
-        "[text(3,5): :]",
-        "[text(3,6):*:]",
+        "[text(2,5):def\n* * *::\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-block-quote:::True]",
@@ -1052,12 +1018,7 @@ def test_whitespaces_thematic_breaks_with_tabs_before_within_double_block_quotes
         "[end-para:::True]",
         "[block-quote(2,1)::> > \n]",
         "[para(2,5):\n \t]",
-        "[text(2,5):def\n::\n]",
-        "[text(3,3):*:]",
-        "[text(3,4): :]",
-        "[text(3,5):*:]",
-        "[text(3,6): :]",
-        "[text(3,7):*:]",
+        "[text(2,5):def\n* * *::\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-block-quote:::True]",
@@ -1091,12 +1052,7 @@ def test_whitespaces_thematic_breaks_with_tabs_before_within_double_block_quotes
         "[end-para:::True]",
         "[block-quote(2,1)::> > \n]",
         "[para(2,5):\n  \t]",
-        "[text(2,5):def\n::\n]",
-        "[text(3,4):*:]",
-        "[text(3,5): :]",
-        "[text(3,6):*:]",
-        "[text(3,7): :]",
-        "[text(3,8):*:]",
+        "[text(2,5):def\n* * *::\n]",
         "[end-para:::True]",
         "[end-block-quote:::True]",
         "[end-block-quote:::True]",
@@ -1212,9 +1168,7 @@ def test_whitespaces_thematic_breaks_with_form_feeds_inside():
     expected_tokens = [
         "[ulist(1,1):*::2:]",
         "[para(1,3):]",
-        "[text(1,3):*:]",
-        "[text(1,4):\u000C:]",
-        "[text(1,5):*:]",
+        "[text(1,3):*\u000C*:]",
         "[end-para:::True]",
         "[end-ulist:::True]",
     ]
diff --git a/test/paragraph_series/test_markdown_paragraph_series_j.py b/test/paragraph_series/test_markdown_paragraph_series_j.py
index e7d51b82..96c5ee03 100644
--- a/test/paragraph_series/test_markdown_paragraph_series_j.py
+++ b/test/paragraph_series/test_markdown_paragraph_series_j.py
@@ -1028,13 +1028,11 @@ def test_paragraph_series_j_em_l_t_t():
     source_markdown = """a*[link](/uri "title")*a"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):*:]",
+        "[text(1,1):a*:]",
         '[link(1,3):inline:/uri:title::::link:False:":: :]',
         "[text(1,4):link:]",
         "[end-link::]",
-        "[text(1,23):*:]",
-        "[text(1,24):a:]",
+        "[text(1,23):*a:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a*<a href="/uri" title="title">link</a>*a</p>"""
@@ -1054,11 +1052,9 @@ def test_paragraph_series_j_em_i_t_t():
     source_markdown = """a*![link](/uri "title")*a"""
     expected_tokens = [
         "[para(1,1):]",
-        "[text(1,1):a:]",
-        "[text(1,2):*:]",
+        "[text(1,1):a*:]",
         '[image(1,3):inline:/uri:title:link::::link:False:":: :]',
-        "[text(1,24):*:]",
-        "[text(1,25):a:]",
+        "[text(1,24):*a:]",
         "[end-para:::True]",
     ]
     expected_gfm = """<p>a*<img src="/uri" alt="link" title="title" />*a</p>"""
diff --git a/test/paragraph_series/test_markdown_paragraph_series_m_fb.py b/test/paragraph_series/test_markdown_paragraph_series_m_fb.py
index 03d14b94..6b1c3eb8 100644
--- a/test/paragraph_series/test_markdown_paragraph_series_m_fb.py
+++ b/test/paragraph_series/test_markdown_paragraph_series_m_fb.py
@@ -560,8 +560,7 @@ foo
     expected_tokens = [
         "[ulist(1,1):-::2::  ]",
         "[para(1,3):\n]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
+        "[text(1,3):abc\n*::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[fcode-block(3,1):`:3::::::]",
@@ -791,8 +790,7 @@ foo
     expected_tokens = [
         "[ulist(1,1):-::2::  ]",
         "[para(1,3):\n]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
+        "[text(1,3):abc\n*::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[fcode-block(3,2):`:3::::: :]",
@@ -1038,8 +1036,7 @@ foo
     expected_tokens = [
         "[ulist(1,1):-::2::  \n  ]",
         "[para(1,3):\n]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
+        "[text(1,3):abc\n*::\n]",
         "[end-para:::False]",
         "[fcode-block(3,3):`:3::::::]",
         "[end-fcode-block::::True]",
diff --git a/test/paragraph_series/test_markdown_paragraph_series_m_ha.py b/test/paragraph_series/test_markdown_paragraph_series_m_ha.py
index 5aa28d04..8d428ad6 100644
--- a/test/paragraph_series/test_markdown_paragraph_series_m_ha.py
+++ b/test/paragraph_series/test_markdown_paragraph_series_m_ha.py
@@ -376,8 +376,7 @@ def test_paragraph_series_m_ha_ul_t_nl_ulb_nl_ha_t():
     expected_tokens = [
         "[ulist(1,1):-::2::  ]",
         "[para(1,3):\n]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
+        "[text(1,3):abc\n*::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[atx(3,1):1:0:]",
@@ -589,8 +588,7 @@ def test_paragraph_series_m_ha_ul_t_nl_ulb_nl_i1_ha_t():
     expected_tokens = [
         "[ulist(1,1):-::2::  ]",
         "[para(1,3):\n]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
+        "[text(1,3):abc\n*::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[atx(3,2):1:0: ]",
@@ -803,8 +801,7 @@ def test_paragraph_series_m_ha_ul_t_nl_ulb_nl_i2_ha_t():
     expected_tokens = [
         "[ulist(1,1):-::2::  \n  \n]",
         "[para(1,3):\n]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
+        "[text(1,3):abc\n*::\n]",
         "[end-para:::False]",
         "[atx(3,3):1:0:]",
         "[text(3,5):foo: ]",
diff --git a/test/paragraph_series/test_markdown_paragraph_series_m_hb.py b/test/paragraph_series/test_markdown_paragraph_series_m_hb.py
index 4e52b562..2ec870bf 100644
--- a/test/paragraph_series/test_markdown_paragraph_series_m_hb.py
+++ b/test/paragraph_series/test_markdown_paragraph_series_m_hb.py
@@ -579,8 +579,7 @@ foo
     expected_tokens = [
         "[ulist(1,1):-::2::  ]",
         "[para(1,3):\n]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
+        "[text(1,3):abc\n*::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[html-block(3,1)]",
@@ -816,8 +815,7 @@ foo
     expected_tokens = [
         "[ulist(1,1):-::2::  ]",
         "[para(1,3):\n]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
+        "[text(1,3):abc\n*::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[html-block(3,1)]",
@@ -1066,8 +1064,7 @@ foo
     expected_tokens = [
         "[ulist(1,1):-::2::  \n  ]",
         "[para(1,3):\n]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
+        "[text(1,3):abc\n*::\n]",
         "[end-para:::False]",
         "[html-block(3,3)]",
         "[text(3,3):<script>:]",
diff --git a/test/paragraph_series/test_markdown_paragraph_series_m_hs.py b/test/paragraph_series/test_markdown_paragraph_series_m_hs.py
index 6b7435d2..58bc47ad 100644
--- a/test/paragraph_series/test_markdown_paragraph_series_m_hs.py
+++ b/test/paragraph_series/test_markdown_paragraph_series_m_hs.py
@@ -577,9 +577,7 @@ foo
     expected_tokens = [
         "[ulist(1,1):-::2::  \n]",
         "[para(1,3):\n\n]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
-        "[text(2,2):\nfoo::\n]",
+        "[text(1,3):abc\n*\nfoo::\n\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[tbreak(4,1):-::---]",
@@ -797,9 +795,7 @@ def test_paragraph_series_m_hs_ul_t_nl_i2_ulb_nl_i1_t_nl_i1_hs():
     expected_tokens = [
         "[ulist(1,1):-::2::  \n]",
         "[para(1,3):\n\n ]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
-        "[text(2,2):\nfoo::\n]",
+        "[text(1,3):abc\n*\nfoo::\n\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[tbreak(4,2):-: :---]",
@@ -1019,9 +1015,7 @@ def test_paragraph_series_m_hs_ul_t_nl_i2_ulb_nl_i2_t_nl_i2_hs():
     expected_tokens = [
         "[ulist(1,1):-::2::  \n  \n  \n]",
         "[setext(4,3):-:3::(1,3)]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
-        "[text(2,2):\nfoo::\n]",
+        "[text(1,3):abc\n*\nfoo::\n\n]",
         "[end-setext::]",
         "[BLANK(5,1):]",
         "[end-ulist:::True]",
diff --git a/test/paragraph_series/test_markdown_paragraph_series_m_ib.py b/test/paragraph_series/test_markdown_paragraph_series_m_ib.py
index 844473f8..7d438898 100644
--- a/test/paragraph_series/test_markdown_paragraph_series_m_ib.py
+++ b/test/paragraph_series/test_markdown_paragraph_series_m_ib.py
@@ -560,9 +560,7 @@ def test_paragraph_series_m_ib_ul_t_nl_i2_ulb_nl_i4_t_ib():
     expected_tokens = [
         "[ulist(1,1):-::2::  \n  \n]",
         "[para(1,3):\n\n  ]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
-        "[text(2,2):\nfoo::\n]",
+        "[text(1,3):abc\n*\nfoo::\n\n]",
         "[end-para:::True]",
         "[BLANK(4,1):]",
         "[end-ulist:::True]",
@@ -872,9 +870,7 @@ def test_paragraph_series_m_ib_i2_ul_nl_i4_ulb_nl_i4_t_ib():
     expected_tokens = [
         "[ulist(1,3):-::4:  :    \n    \n]",
         "[para(1,5):\n\n]",
-        "[text(1,5):abc\n::\n]",
-        "[text(2,1):*:]",
-        "[text(2,2):\nfoo::\n]",
+        "[text(1,5):abc\n*\nfoo::\n\n]",
         "[end-para:::True]",
         "[BLANK(4,1):]",
         "[end-ulist:::True]",
@@ -966,9 +962,7 @@ def test_paragraph_series_m_ib_i2_ul_t_nl_i4_ulb_nl_i4_t_ib():
     expected_tokens = [
         "[ulist(1,3):-::4:  :    \n    \n]",
         "[para(1,5):\n\n]",
-        "[text(1,5):abc\n::\n]",
-        "[text(2,1):*:]",
-        "[text(2,2):\nfoo::\n]",
+        "[text(1,5):abc\n*\nfoo::\n\n]",
         "[end-para:::True]",
         "[BLANK(4,1):]",
         "[end-ulist:::True]",
diff --git a/test/paragraph_series/test_markdown_paragraph_series_m_tb.py b/test/paragraph_series/test_markdown_paragraph_series_m_tb.py
index de066384..3e070d88 100644
--- a/test/paragraph_series/test_markdown_paragraph_series_m_tb.py
+++ b/test/paragraph_series/test_markdown_paragraph_series_m_tb.py
@@ -353,8 +353,7 @@ def test_paragraph_series_m_tb_ul_t_nl_ulb_nl_tb():
     expected_tokens = [
         "[ulist(1,1):-::2::  ]",
         "[para(1,3):\n]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
+        "[text(1,3):abc\n*::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[tbreak(3,1):-::---]",
@@ -389,8 +388,7 @@ def test_paragraph_series_m_tb_ul_t_nl_ul_t_nl_ulb_nl_tb():
         "[end-para:::True]",
         "[li(2,1):2::]",
         "[para(2,3):\n]",
-        "[text(2,3):def\n::\n]",
-        "[text(3,1):*:]",
+        "[text(2,3):def\n*::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[tbreak(4,1):-::---]",
@@ -426,8 +424,7 @@ def test_paragraph_series_m_tb_ul_t_nl_ul_t_nl_i3_ulb_nl_tb():
         "[end-para:::True]",
         "[li(2,1):2::]",
         "[para(2,3):\n]",
-        "[text(2,3):def\n::\n]",
-        "[text(3,1):*:]",
+        "[text(2,3):def\n*::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[tbreak(4,1):-::---]",
@@ -673,8 +670,7 @@ def test_paragraph_series_m_tb_ul_t_nl_ulb_nl_i1_tb():
     expected_tokens = [
         "[ulist(1,1):-::2::  ]",
         "[para(1,3):\n]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
+        "[text(1,3):abc\n*::\n]",
         "[end-para:::True]",
         "[end-ulist:::True]",
         "[tbreak(3,2):-: :---]",
@@ -949,8 +945,7 @@ def test_paragraph_series_m_tb_ul_t_nl_ulb_nl_i2_tb():
     expected_tokens = [
         "[ulist(1,1):-::2::  \n  \n]",
         "[setext(3,3):-:3::(1,3)]",
-        "[text(1,3):abc\n::\n]",
-        "[text(2,1):*:]",
+        "[text(1,3):abc\n*::\n]",
         "[end-setext::]",
         "[BLANK(4,1):]",
         "[end-ulist:::True]",
diff --git a/test/rules/test_md037.py b/test/rules/test_md037.py
index 9cde78b2..5df8b7ea 100644
--- a/test/rules/test_md037.py
+++ b/test/rules/test_md037.py
@@ -20,6 +20,7 @@ scanTests = [
     pluginRuleTest(
         "good_valid_emphasis",
         source_file_name=f"{source_path}good_valid_emphasis.md",
+        use_debug=True,
     ),
     pluginRuleTest(
         "bad_surrounding_emphasis",
@@ -33,10 +34,43 @@ this text ** is ** in bold
 this text __ is __ in bold
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:3:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:5:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:7:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:1:15: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:3:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:3:15: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:5:13: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:5:16: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:7:13: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:7:16: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+""",
+        fix_expected_file_contents="""this text *is* in italics
+
+this text _is_ in italics
+
+this text **is** in bold
+
+this text __is__ in bold
+""",
+    ),
+    pluginRuleTest(
+        "bad_surrounding_emphasis_extra",
+        source_file_contents="""this text *  is  * in italics
+
+this text _  is  _ in italics
+
+this text **  is  ** in bold
+
+this text __  is  __ in bold
+""",
+        scan_expected_return_code=1,
+        scan_expected_output="""{temp_source_path}:1:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:1:17: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:3:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:3:17: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:5:13: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:5:18: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:7:13: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:7:18: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""this text *is* in italics
 
@@ -47,6 +81,55 @@ this text **is** in bold
 this text __is__ in bold
 """,
     ),
+    pluginRuleTest(
+        "bad_surrounding_emphasis_short_non_first",
+        source_file_contents="""this is the first line
+this text * is * in italics
+""",
+        scan_expected_return_code=1,
+        scan_expected_output="""{temp_source_path}:2:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:2:15: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+""",
+        fix_expected_file_contents="""this is the first line
+this text *is* in italics
+""",
+    ),
+    pluginRuleTest(
+        "bad_surrounding_emphasis_short_with_backslash_before",
+        source_file_contents="""this \\* text * is * in italics
+""",
+        scan_expected_return_code=1,
+        scan_expected_output="""{temp_source_path}:1:15: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:1:18: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+""",
+        fix_expected_file_contents="""this \\* text *is* in italics
+""",
+    ),
+    pluginRuleTest(
+        "bad_surrounding_emphasis_short_with_reference_before",
+        source_file_contents="""this &#x2a; text * is * in italics
+""",
+        scan_expected_return_code=1,
+        scan_expected_output="""{temp_source_path}:1:19: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:1:22: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+""",
+        fix_expected_file_contents="""this &#x2a; text *is* in italics
+""",
+    ),
+    pluginRuleTest(
+        "good_surrounding_emphasis_short_with_mixed",
+        source_file_contents="""this * text _ is * in _ italics
+""",
+        scan_expected_return_code=0,
+        scan_expected_output="",
+    ),
+    pluginRuleTest(
+        "good_surrounding_emphasis_short_with_other_mixed",
+        source_file_contents="""this _ text * is _ in * italics
+""",
+        scan_expected_return_code=0,
+        scan_expected_output="",
+    ),
     pluginRuleTest(
         "bad_leading_emphasis",
         source_file_name=f"{source_path}bad_leading_emphasis.md",
@@ -59,10 +142,10 @@ this text ** is** in bold
 this text __ is__ in bold
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:3:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:5:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:7:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:3:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:5:13: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:7:13: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""this text *is* in italics
 
@@ -85,10 +168,10 @@ this text **is ** in bold
 this text __is __ in bold
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:3:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:5:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:7:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:14: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:3:14: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:5:15: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:7:15: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""this text *is* in italics
 
@@ -115,10 +198,51 @@ this text __ is
 not __ in bold
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:4:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:7:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:10:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:2:4: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:4:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:5:4: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:7:13: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:8:4: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:10:13: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:11:4: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+""",
+        fix_expected_file_contents="""this text *is
+not* in italics
+
+this text _is
+not_ in italics
+
+this text **is
+not** in bold
+
+this text __is
+not__ in bold
+""",
+    ),
+    pluginRuleTest(
+        "bad_surrounding_emphasis_multiline_extra",
+        source_file_contents="""this text *  is
+not  * in italics
+
+this text _  is
+not  _ in italics
+
+this text **  is
+not  ** in bold
+
+this text __  is
+not  __ in bold
+""",
+        scan_expected_return_code=1,
+        scan_expected_output="""{temp_source_path}:1:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:2:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:4:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:5:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:7:13: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:8:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:10:13: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:11:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""this text *is
 not* in italics
@@ -150,10 +274,14 @@ this text __ is __ in bold
 """,
         scan_expected_return_code=1,
         use_debug=True,
-        scan_expected_output="""{temp_source_path}:1:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:4:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:7:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:10:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:1:15: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:4:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:4:15: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:7:13: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:7:16: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:10:13: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:10:16: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""this text *is* in italics
 ===
@@ -180,10 +308,14 @@ this text __is__ in bold
 ## this text __ is __ in bold
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:13: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:3:14: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:5:14: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:7:14: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:14: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:1:17: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:3:15: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:3:18: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:5:16: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:5:19: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:7:16: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:7:19: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""# this text *is* in italics
 
@@ -204,9 +336,12 @@ this text __is__ in bold
 > this is * not in * italics
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:3:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
-{temp_source_path}:5:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:13: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:1:20: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:3:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:3:19: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:5:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:5:19: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""1. this is *not in* italics
 
@@ -228,7 +363,19 @@ this text __is__ in bold
         source_file_contents="""abc * [link](/url) * ghi
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:6: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:1:19: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+""",
+        fix_expected_file_contents="""abc *[link](/url)* ghi
+""",
+    ),
+    pluginRuleTest(
+        "bad_surrounding_emphasis_link_surround_extra",
+        source_file_contents="""abc *  [link](/url)  * ghi
+""",
+        scan_expected_return_code=1,
+        scan_expected_output="""{temp_source_path}:1:6: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:1:21: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""abc *[link](/url)* ghi
 """,
@@ -238,7 +385,7 @@ this text __is__ in bold
         source_file_contents="""abc * [link](/url)* ghi
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:6: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""abc *[link](/url)* ghi
 """,
@@ -248,7 +395,7 @@ this text __is__ in bold
         source_file_contents="""abc *[link](/url) * ghi
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:18: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""abc *[link](/url)* ghi
 """,
@@ -258,7 +405,8 @@ this text __is__ in bold
         source_file_contents="""abc * \\! * ghi
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:6: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:1:9: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""abc *\\!* ghi
 """,
@@ -268,7 +416,7 @@ this text __is__ in bold
         source_file_contents="""abc * \\!* ghi
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:6: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""abc *\\!* ghi
 """,
@@ -278,7 +426,7 @@ this text __is__ in bold
         source_file_contents="""abc *\\! * ghi
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:8: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""abc *\\!* ghi
 """,
@@ -288,7 +436,8 @@ this text __is__ in bold
         source_file_contents="""abc * &amp; * ghi
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:6: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:1:12: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""abc *&amp;* ghi
 """,
@@ -298,7 +447,7 @@ this text __is__ in bold
         source_file_contents="""abc * &amp;* ghi
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:6: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""abc *&amp;* ghi
 """,
@@ -308,7 +457,7 @@ this text __is__ in bold
         source_file_contents="""abc *&amp; * ghi
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:11: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""abc *&amp;* ghi
 """,
@@ -318,7 +467,8 @@ this text __is__ in bold
         source_file_contents="""abc * <http://google.com> * ghi
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:6: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+{temp_source_path}:1:26: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""abc *<http://google.com>* ghi
 """,
@@ -328,7 +478,7 @@ this text __is__ in bold
         source_file_contents="""abc * <http://google.com>* ghi
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:6: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""abc *<http://google.com>* ghi
 """,
@@ -338,7 +488,7 @@ this text __is__ in bold
         source_file_contents="""abc *<http://google.com> * ghi
 """,
         scan_expected_return_code=1,
-        scan_expected_output="""{temp_source_path}:1:5: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
+        scan_expected_output="""{temp_source_path}:1:25: MD037: Spaces inside emphasis markers (no-space-in-emphasis)
 """,
         fix_expected_file_contents="""abc *<http://google.com>* ghi
 """,
diff --git a/test/test_markdown_extra.py b/test/test_markdown_extra.py
index 33e818cf..aee8a8cf 100644
--- a/test/test_markdown_extra.py
+++ b/test/test_markdown_extra.py
@@ -2019,11 +2019,7 @@ def test_extra_020d():
         "[block-quote(1,1)::> \n> \n> \n> \n> ]",
         "[olist(1,3):.:1:5::   \n\n   \n]",
         "[para(1,6):\n\n\n]",
-        "[text(1,6):list\nthis\n\u00a0\n::\n\n\n]",
-        "[text(4,1):[:]",
-        "[text(4,2):abc:]",
-        "[text(4,5):]:]",
-        "[text(4,6):: /url:]",
+        "[text(1,6):list\nthis\n\u00a0\n[abc]: /url::\n\n\n]",
         "[end-para:::True]",
         "[li(5,3):5::1]",
         "[para(5,6):]",
@@ -5863,13 +5859,7 @@ def test_extra_042x():
         "[end-atx::]",
         "[BLANK(2,1):]",
         "[atx(3,1):2:0:]",
-        "[text(3,4):Example: : ]",
-        "[text(3,13):[:]",
-        "[text(3,14):foo:]",
-        "[text(3,17):]:]",
-        "[text(3,18):[:]",
-        "[text(3,19):bar:]",
-        "[text(3,22):]:]",
+        "[text(3,4):Example: [foo][bar]: ]",
         "[end-atx::]",
         "[BLANK(4,1):]",
         "[link-ref-def(5,1):True::foo:: :https://example.com:::::]",
@@ -6020,6 +6010,44 @@ def test_extra_042xc():
     act_and_assert(source_markdown, expected_gfm, expected_tokens)
 
 
+@pytest.mark.gfm
+def test_extra_043x():
+    """
+    TBD
+    """
+
+    # Arrange
+    source_markdown = """this \\* text * is * in italics"""
+    expected_tokens = [
+        "[para(1,1):]",
+        "[text(1,1):this \\\b* text * is * in italics:]",
+        "[end-para:::True]",
+    ]
+    expected_gfm = """<p>this * text * is * in italics</p>"""
+
+    # Act & Assert
+    act_and_assert(source_markdown, expected_gfm, expected_tokens)
+
+
+@pytest.mark.gfm
+def test_extra_043a():
+    """
+    TBD
+    """
+
+    # Arrange
+    source_markdown = """this &#x2a; text * is * in italics"""
+    expected_tokens = [
+        "[para(1,1):]",
+        "[text(1,1):this \a&#x2a;\a*\a text * is * in italics:]",
+        "[end-para:::True]",
+    ]
+    expected_gfm = """<p>this * text * is * in italics</p>"""
+
+    # Act & Assert
+    act_and_assert(source_markdown, expected_gfm, expected_tokens)
+
+
 @pytest.mark.gfm
 def test_extra_999():
     """