Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash on callout #5

Closed
powerman opened this issue Jul 19, 2024 · 1 comment
Closed

Crash on callout #5

powerman opened this issue Jul 19, 2024 · 1 comment
Assignees

Comments

@powerman
Copy link

This very usual callout:

> **NOTE**

result in a crash:

$ echo '> **NOTE**' | mdformat --check -
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.12/mdformat", line 8, in <module>
    sys.exit(run())
             ^^^^^
  File "/usr/lib/python3.12/site-packages/mdformat/__main__.py", line 8, in run
    exit_code = mdformat._cli.run(sys.argv[1:])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mdformat/_cli.py", line 70, in run
    formatted_str = mdformat.text(
                    ^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mdformat/_api.py", line 31, in text
    rendering = mdit.render(md)
                ^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/markdown_it/main.py", line 291, in render
    return self.renderer.render(self.parse(src, env), self.options, env)
                                ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/markdown_it/main.py", line 276, in parse
    self.core.process(state)
  File "/usr/lib/python3.12/site-packages/markdown_it/parser_core.py", line 45, in process
    rule(state)
  File "/usr/lib/python3.12/site-packages/markdown_it/rules_core/block.py", line 13, in block
    state.md.block.parse(state.src, state.md, state.env, state.tokens)
  File "/usr/lib/python3.12/site-packages/markdown_it/parser_block.py", line 110, in parse
    self.tokenize(state, state.line, state.lineMax)
  File "/usr/lib/python3.12/site-packages/markdown_it/parser_block.py", line 85, in tokenize
    if rule(state, line, endLine, False):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/markdown_it/rules_block/blockquote.py", line 280, in blockquote
    state.md.block.tokenize(state, startLine, nextLine)
  File "/usr/lib/python3.12/site-packages/markdown_it/parser_block.py", line 85, in tokenize
    if rule(state, line, endLine, False):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mdformat_obsidian/mdit_plugins/_obsidian_callouts.py", line 95, in alert_logic
    result = parser_func(state, startLine, endLine, silent)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mdformat_obsidian/factories/_obsidian_blockquote_factories.py", line 94, in parse_possible_blockquote_admon
    folded=bool(match["folded"]),
                ~~~~~^^^^^^^^^^
IndexError: no such group

Installed versions:

$ mdformat --version
mdformat 0.7.17 (mdformat_obsidian: 0.0.2, mdformat_gfm: 0.3.6, mdformat_footnote: 0.1.1,
mdformat_frontmatter: 2.0.8, mdformat_tables: 0.4.1, mdformat_simple_breaks: 0.0.1,
mdformat_wikilink: 0.2.0)
@KyleKing KyleKing self-assigned this Jul 20, 2024
KyleKing added a commit to KyleKing/mdformat-gfm-alerts that referenced this issue Aug 1, 2024
@KyleKing
Copy link
Owner

KyleKing commented Aug 1, 2024

I had some time this evening and patched this issue in v0.0.3 (b860d0b)

@KyleKing KyleKing closed this as completed Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants