Skip to content

Commit

Permalink
Allow matching prefix with curly braces in `CodeExample.prefix_settin…
Browse files Browse the repository at this point in the history
…gs()` (#44)

The SuperFences markdown extensions uses the following format for attributes:
`lang-name {.extra-class attr="a"}`

See: https://facelessuser.github.io/pymdown-extensions/extensions/superfences/#injecting-classes-ids-and-attributes
  • Loading branch information
Viicos authored Nov 20, 2024
1 parent 8ae0f2a commit 3932676
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pytest_examples/find_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def prefix_settings(self) -> dict[str, str]:
This works on the format `py foo="bar" spam="with space"`.
"""
settings = {}
for m in re.finditer(r'(\S+?)=([\'"])(.+?)\2', self.prefix):
for m in re.finditer(r'([^{\s]+?)=([\'"])(.+?)\2', self.prefix):
settings[m.group(1)] = m.group(3)
return settings

Expand Down

0 comments on commit 3932676

Please sign in to comment.