BMPixel / moffee

moffee: Make Markdown Ready to Present
https://moffee.readthedocs.io
MIT License
892 stars 41 forks source link

moffee live example.md not work #10

Closed imangozhang closed 2 months ago

imangozhang commented 2 months ago

python3: 3.10.11 pipx: 1.7.1 MacOS intel

Traceback (most recent call last): File "/Users/imangozhang/.local/bin/moffee", line 8, in sys.exit(cli()) File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/click/core.py", line 783, in invoke return __callback(args, *kwargs) File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/moffee/cli.py", line 78, in live run(markdown, output=None, live=True) File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/moffee/cli.py", line 24, in run render_handler() File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/moffee/builder.py", line 115, in build output_html = render_jinja2(document, output_dir) File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/moffee/builder.py", line 104, in render_jinja2 return template.render(data) File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/jinja2/environment.py", line 1304, in render self.environment.handle_exception() File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/jinja2/environment.py", line 939, in handle_exception raise rewrite_traceback_stack(source=source) File "/var/folders/mp/rw03d2j91jg8cq2_st2pbr6w0000gn/T/tmpvyr48r49/index.html", line 20, in top-level template code {% include 'layouts/' + layout + '.html' %} File "/var/folders/mp/rw03d2j91jg8cq2_st2pbr6w0000gn/T/tmpvyr48r49/layouts/centered.html", line 27, in top-level template code {{ render_chunk(slide.chunk) }} File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/jinja2/runtime.py", line 782, in _invoke rv = self._func(arguments) File "/var/folders/mp/rw03d2j91jg8cq2_st2pbr6w0000gn/T/tmpvyr48r49/layouts/centered.html", line 16, in template {{ chunk.paragraph | markdown }} File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/moffee/markdown.py", line 36, in md return Markup(markdown(text, extensions=extensions, extension_configs=extension_configs)) File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/markdown/core.py", line 481, in markdown md = Markdown(**kwargs) File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/markdown/core.py", line 126, in init self.registerExtensions(extensions=kwargs.get('extensions', []), File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/markdown/core.py", line 179, in registerExtensions ext = self.build_extension(ext, configs.get(ext, {})) File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/markdown/core.py", line 225, in build_extension module = importlib.import_module(ext_name) File "/usr/local/Cellar/python@3.9/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1030, in _gcd_import File "", line 1007, in _find_and_load File "", line 986, in _find_and_load_unlocked File "", line 680, in _load_unlocked File "", line 855, in exec_module File "", line 228, in _call_with_frames_removed File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/moffee/utils/md_obsidian_ext.py", line 22, in class ObsidianProcessor(BlockProcessor): File "/Users/imangozhang/.local/pipx/venvs/moffee/lib/python3.9/site-packages/moffee/utils/md_obsidian_ext.py", line 85, in ObsidianProcessor def get_class_and_title(self, match: re.Match[str]) -> tuple[str, str | None]: TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

imangozhang commented 2 months ago

example.md context is from this repo readme

BMPixel commented 2 months ago

I see that you are using python 3.9 to run moffee. The minimum version requirement for moffee is 3.10. Can you try moffee --version and show me the results? I'm wondering if an old version is installed. Thank you.

Anyway, try upgrading your pipx and reinstall with python >= 3.10.