Skip to content

Commit

Permalink
Added get_md_text method to MdUtils class.
Browse files Browse the repository at this point in the history
`get_md_text` will return the md text as a string instead of writing a new file.
  • Loading branch information
Patitotective authored and didix21 committed Oct 16, 2021
1 parent 26ae294 commit c7c119c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions mdutils/mdutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ def create_md_file(self):
)
return md_file

def get_md_text(self) -> str:
"""Instead of writing the markdown text into a file it returns it as a string.
:return: return a string with the markdown text."""
return self.title + self.table_of_contents + self.file_data_text + self.reference.get_references_as_markdown()

def read_md_file(self, file_name):
"""Reads a Markdown file and save it to global class `file_data_text`.
Expand Down

0 comments on commit c7c119c

Please sign in to comment.