Fix add-on config screen failing to show in bundled build

md_in_html imports fine when done manually; it is likely PyOxidizer
has not instrumented import_module().

  File "aqt.addons", line 631, in addonConfigHelp
  File "markdown.core", line 386, in markdown
  File "markdown.core", line 96, in __init__
  File "markdown.core", line 123, in registerExtensions
  File "markdown.core", line 162, in build_extension
  File "importlib", line 127, in import_module
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'md_in_html'
This commit is contained in:
Damien Elmes 2022-02-28 20:49:24 +10:00
parent 92bf23df99
commit 6ae24652e5

View File

@ -19,6 +19,7 @@ from zipfile import ZipFile
import jsonschema
import markdown
from jsonschema.exceptions import ValidationError
from markdown.extensions import md_in_html
from send2trash import send2trash
import anki
@ -628,7 +629,7 @@ class AddonManager:
else:
return ""
return markdown.markdown(contents, extensions=["md_in_html"])
return markdown.markdown(contents, extensions=[md_in_html.makeExtension()])
def addonFromModule(self, module: str) -> str:
return module.split(".")[0]