Added initial support for Markdown - issue-8 #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #8
The original tool had no support for Markdown files. I've added initial support for Markdown files with the use of regex.
import re
is needed to use regex.The tool will now also read files that ends with ".md"
In TextFile.process_file(), the code will process between ".txt" and ".md" files.
The process for ".txt" files have not been changed.
For ".md" files, it will process markdown syntax features for
I've created regex patterns for each individual syntax for easier implementation and editing.
To handle bold and italics, I've used the findall() function in python to find all instances where the contents matches the regex in a single paragraph. Then I've replaced all matching instances from their Markdown syntax to having the corresponding html tag.
I've noticed that html italic and bold tags will cause the generated files to create new indented code blocks in html.
For example
in .md files will generate in html as
The webpage will generate looking fine. But I'm still trying to figure out if this might be the cause of BeautifulSoup parsing, or something else.
Please review and provide feedback at your latest convenience. Thanks!