8000 blank lines at the beginning of a file · Issue #95 · didix21/mdutils · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
blank lines at the beginning of a file #95
Open
@bboles

Description

@bboles

Describe the bug
There may be one or more blank lines at the beginning of the file. There is not any functional reason for this and the behavior may cause other unintended side-effects.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new markdown doc. There will a blank line at the beginning of the doc:
[nav] In [18]: md = MdUtils(file_name='Example')
          ...: md.new_header(level=1, title='Example Header')
Out[18]: '\n# Example Header\n'

Expected behavior
No blank lines at the beginning of the file.

Desktop (please complete the following information):

  • OS: MacOS
  • Version: 13.4

Additional context
It looks like most every operation that adds new markdown content intentionally has a newline at the beginning of the string. For example:

return "\n" + "#" * level.value + " " + title + header_id + "\n"

Additionally with the create_md_file function it looks like there may be more that one blank line added if you don't specify anything for title or have a table of contents:

md_file.rewrite_all_file(
    data=self.title
    + self.table_of_contents
    + self.file_data_text
    + self.reference.get_references_as_markdown()

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0