def action()

in migration/src/markup/lists.py [0:0]


    def action(self, tokens: ParseResults) -> str:
        result = []

        for line in tokens:
            # print(repr(line))
            if line == "\n":
                # can't really explain but if this is the first item, an empty string should be added to preserve line feed
                if len(result) == 0:
                    result.append("")
                continue
            cols = line.split(" ", maxsplit=1)
            if len(cols) > 1:
                bullets, text = cols[0], cols[1]
            else:
                # occasionally, the separator can be a tab (commitbot's comment)
                cols = line.split("\t", maxsplit=1)
                if len(cols) > 1:
                    bullets, text = cols[0], cols[1]
                else:
                    continue

            nested_indent = 0
            while bullets[0] == self.nested_token:
                nested_indent += 1
                bullets = bullets[1:]

            count = nested_indent * self.nested_indent + len(bullets) * self.indent

            line_padding = " " * count
            item_padding = " " * (count - self.indent) + self.bullet + " "
            text = self.markup.transformString(text).splitlines() or [""]

            result.append(
                "\n".join([item_padding + line if i == 0 else line_padding + line for i, line in enumerate(text)]),
            )

        self.indent_state.reset()
        text_end = "\n" if (tokens[-1][-1] == "\n") else ""
        return "\n".join(result) + text_end