Skip to content

Error if a file is empty #14

@sebix

Description

@sebix

If one of the source files is empty, this exception occurs:

Traceback (most recent call last):
  File "/usr/lib64/python3.13/site-packages/mkdocs/livereload/__init__.py", line 211, in _build_loop
    self.builder()
    ~~~~~~~~~~~~^^
  File "/usr/lib64/python3.13/site-packages/mkdocs/commands/serve.py", line 67, in builder
    build(config, serve_url=None if is_clean else serve_url, dirty=is_dirty)
    ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/site-packages/mkdocs/commands/build.py", line 347, in build
    config.plugins.on_post_build(config=config)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/site-packages/mkdocs/plugins.py", line 602, in on_post_build
    return self.run_event('post_build', config=config)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/site-packages/mkdocs/plugins.py", line 568, in run_event
    result = method(**kwargs)
  File "/usr/lib64/python3.13/site-packages/mkdocs_pandoc/plugin.py", line 130, in on_post_build
    self.renderer.write_combined_pandoc(abs_pandoc_path)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/site-packages/mkdocs_pandoc/renderer.py", line 97, in write_combined_pandoc
    if not lines[-1].endswith("\n"):
           ~~~~~^^^^
IndexError: list index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions