Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

[fix] TypeError coming from suffix arg removed from sphinx v3.0.0 #55

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions m2r.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,11 +649,11 @@ def setup(app):
app.add_config_value('m2r_parse_relative_links', False, 'env')
app.add_config_value('m2r_anonymous_references', False, 'env')
app.add_config_value('m2r_disable_inline_math', False, 'env')
if hasattr(app, 'add_source_suffix'):
try:
app.add_source_parser('.md', M2RParser) # for older sphinx versions
except TypeError:
app.add_source_suffix('.md', 'markdown')
app.add_source_parser(M2RParser)
Comment on lines +652 to 656

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if add_source_parser and add_source_suffix should be treated differently altogether:

Suggested change
try:
app.add_source_parser('.md', M2RParser) # for older sphinx versions
except TypeError:
app.add_source_suffix('.md', 'markdown')
app.add_source_parser(M2RParser)
if hasattr(app, 'add_source_suffix'):
app.add_source_suffix('.md', 'markdown')
try:
app.add_source_parser('.md', M2RParser) # for older sphinx versions
except TypeError:
app.add_source_parser(M2RParser)

else:
app.add_source_parser('.md', M2RParser)
app.add_directive('mdinclude', MdInclude)
metadata = dict(
version=__version__,
Expand Down