trentm / trentm/python-markdown2
started with ------
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.8k
- Forks
- 459
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 4
Description
It occur error when the markdown text start with '------' and there aren't warp before the '------' .
mymarkdown = markdown2.Markdown(
extras=["code-friendly", "code-color", "cuddled-lists", "fenced-code-blocks", "footnotes", "header-ids",
"markdown-in-html", "metadata", "nofollow", "numbering", "pyshell",
"smarty-pants",
"spoiler", "target-blank-links", "toc", "tables", "use-file-vars", "wiki-tables", "xml", "tag-friendly"]
)
print mymarkdown.convert("------sdfsadfds")
eg error:
Traceback (most recent call last):
File "C:/Users/Administrator/PycharmProjects/teamdoc/website/tests.py", line 9, in <module>
print mymarkdown.convert("------sdfsadfds")
File "C:\Python27\lib\site-packages\markdown2.py", line 319, in convert
text = self._extract_metadata(text)
File "C:\Python27\lib\site-packages\markdown2.py", line 414, in _extract_metadata
metadata_content = fence_splits[1]
IndexError: list index out of range
It works if i add '\n' before the '------'.
eg:
print mymarkdown.convert("\n------sdfsadfds")
It works if i don't open these extras.
eg:
mymarkdown=markdown2.Markdown()
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in markdown2.py at _extract_metadata, using the reported conversion of "------sdfsadfds" with the listed extras to reproduce the IndexError. Compare it with the newline-prefixed and no-extras cases; done means the input converts without an IndexError while preserving existing behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100