Skip to content

Commit

Permalink
Import docutils types from new locations
Browse files Browse the repository at this point in the history
This attempts to import ErrorString and SafeString from their new
locations in docutils, and falls back to their previous locations if the
import fails.

Fixes #8
  • Loading branch information
amyreese committed Aug 26, 2022
1 parent d5a950d commit 3c2c155
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sphinx_mdinclude/sphinx.py
Expand Up @@ -6,10 +6,14 @@
import os.path

from docutils import io, nodes, statemachine, utils
from docutils.core import ErrorString
from docutils.parsers import rst
from docutils.parsers.rst import directives as rst_directives
from docutils.utils import SafeString

try: # new
from docutils.utils.error_reporting import ErrorString, SafeString
except ImportError: # old
from docutils.core import ErrorString # type: ignore
from docutils.utils import SafeString # type: ignore

from . import RestMarkdown

Expand Down

0 comments on commit 3c2c155

Please sign in to comment.