Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_markdown_config['extensions'] == None bug #18

Closed
ChrisDaunt1984 opened this issue Feb 6, 2023 · 0 comments
Closed

_markdown_config['extensions'] == None bug #18

ChrisDaunt1984 opened this issue Feb 6, 2023 · 0 comments

Comments

@ChrisDaunt1984
Copy link

Hi

I have encountered the following bug when running a minimal setup on version 0.6.0

  File "...\site-packages\mkdocs_literate_nav\parser.py", line 59, in markdown_to_nav
    extensions=[ext, *self._markdown_config.get("extensions", ())],
TypeError: Value after * must be an iterable, not NoneType

it seems self._markdown_extensions are getting set to the following when looking through the debugger

{'extensions': None, 'extension_configs': {}, 'tab_length': 4}

so when extesions == None, the following code will cause the error above

  def markdown_to_nav(self, roots: tuple[str, ...] = (".",)) -> Nav:
      root = roots[0]
      ext = _MarkdownExtension()
      dir_nav = self.get_nav_for_dir(root)
      if dir_nav:
          nav_file_name, md = dir_nav
          markdown_config = dict(
              self._markdown_config,
              extensions=[ext, *self._markdown_config.get("extensions", ())],
          )

the following seems to resolve this bug in the case where there are no markdown extension

    def markdown_to_nav(self, roots: tuple[str, ...] = (".",)) -> Nav:
        root = roots[0]
        ext = _MarkdownExtension()
        dir_nav = self.get_nav_for_dir(root)
        extensions = self._markdown_config.get("extensions", ()) or ()
        if dir_nav:
            nav_file_name, md = dir_nav
            markdown_config = dict(
                self._markdown_config,
                extensions=[ext, *extensions],
            )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant