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

blank lines at the beginning of a file #95

Open
bboles opened this issue Jun 8, 2023 · 0 comments
Open

blank lines at the beginning of a file #95

bboles opened this issue Jun 8, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@bboles
Copy link

bboles commented Jun 8, 2023

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()
@bboles bboles added the bug Something isn't working label Jun 8, 2023
@didix21 didix21 self-assigned this Jun 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants