Skip to content

plugin crash  #67

@brunseba

Description

@brunseba

Description

mkdocs serve always crash when mkdocs-newsletter is enabled

Steps to reproduce

site_name: My Docs Newsletter plugin test

plugins:
  - git-revision-date-localized:
      type: timeago
  - autolinks
  - section-index
  - mkdocs-newsletter
  - exclude-search:
      exclude:
        - newsletter/*

markdown_extensions:
  - toc:
      baselevel: 2

theme:
    name: material

and execute mkdocs serve

Current behavior

Desired behavior

A usable plugin

Screenshots

± |master ?:2 ✗| → mkdocs serve
INFO     -  Building documentation...
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mkdocs/__main__.py", line 177, in serve_command
    serve.serve(dev_addr=dev_addr, livereload=livereload, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 54, in serve
    config = builder()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 49, in builder
    build(config, live_server=live_server, dirty=dirty)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mkdocs/commands/build.py", line 257, in build
    config = config['plugins'].run_event('config', config)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mkdocs/plugins.py", line 102, in run_event
    result = method(item, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mkdocs_newsletter/entrypoints/mkdocs_plugin.py", line 68, in on_config
    config = build_nav(config, newsletter_dir)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mkdocs_newsletter/services/nav.py", line 68, in build_nav
    return _nav_data_to_nav(nav_data, config)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mkdocs_newsletter/services/nav.py", line 113, in _nav_data_to_nav
    config["nav"].append({"Newsletters": newsletter_nav})
AttributeError: 'NoneType' object has no attribute 'append'

Environment

± |master ?:2 ✗| → python -c "import mkdocs_newsletter.version; print(mkdocs_newsletter.version.version_info())"
mkdocs_newsletter version: 0.3.1
python version: 3.8.6 (v3.8.6:db455296be, Sep 23 2020, 13:31:39) [Clang 6.0 (clang-600.0.57)]
platform: macOS-10.16-x86_64-i386-64bit

mkdocs, version 1.2.3 from /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/mkdocs (Python 3.8)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions