-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add initial support for Markdown #9
Conversation
To test the file
|
Thanks! Good work on this especially with how you included multiple markdown features (including links!) but there are a couple of problems that need addressing: Initially, when testing this out with
which traces to an incorrect function call in the def markdownfeat(input_filename):
...
def convertMD(userInput):
new_title=userInput
...
body = markdownfeat(new_title, html_newfile_path) # assign the newly created markdown feat to body to be assigned to the proper HTML format (ERROR HERE!) The program works correctly after fixing it (removing html_newfile_path as its not used in Another problem has to do with the HTML conversion. Your method of replacing each md styling is very good and efficient but when converting it forgets to use any In your example: <body>
This is a markdown Test <!-- not in a <p> tag -->
<em>The markdown test with an Italicized sentence</em><br><br>
<strong>The markdown test with a bold sentence and below is where the link is changed to match the style properly</strong><br><br>
<a href=" (https://github.com/rabroldan/textml)">Link</a> <br><br>
</body> Lastly, when the HTML file is created (using A change that has to be made for your implementation is how your In the main implementation, I assume 1 of 3 things could happen: a single file is passed (regardless of extension for now), a directory is passed, or a single command is issued. When you call if done != True or userInput.find(".") != -1: # Checking if the file is md
if ".md" in userInput:
convertMD(userInput)
done = True
else:
Exception("Error!: Invalid file type") It adds a fourth option: convert a single To properly correct this I ask you to put the if done != True or userInput.find(".") != -1: # Checking if the passed argument is a file
if ".txt" in userInput:
convertText(userInput, outDir)
done = True
elif ".md" in userInput:
convertMD(userInput)
done = True
else:
Exception("Error!: Invalid file type") Having the same thing being updated within the directory handling (in the for loop) so that it could process a passed directory full of both After these issues and changes are fixed and implemented this pull request can be merged. Feel free to ask any more questions for clarification. |
Markdown feature has been updated it now takes all Markdown syntax features for [Italics, Bold, Heading 1, Heading 2, or a Link It now output in the testml directory or if any specified directory it is also processed in the examples directory if an md file is in the example Example - for within directory md processing it still go to the testml directory
Example - for outside the directory md processing it still go to the testml directory
Example - for outside the directory md processing and specified directory it now go to that specified directory
Features has now been updated and proper tags is created |
Alright, this fixes all the issues that I mentioned before thanks. A couple more small changes and additions need to be made before it can be merged.
There is a double import (imports are at the top) on line 177 of my textml.py in 81033a9 No test files: There are no test files provided in the project. Please add a test4.md or equivalent file in the examples folder.
When a fw = open(outDir + newHTMLFile + ".html", 'w') # Writing new html file to output directory
parseTitle = fo.readlines()[0:3] # Reading first 3 lines for title
if parseTitle[1] == '\n' and parseTitle[2] == '\n':
fw.write(writeHTMLHeader(parseTitle[0].rstrip('\n'))) # HTML header as parsed title
fw.write("<h1>" + parseTitle[0].rstrip('\n') + '</h1>\n') # Writing found title to html
fo.seek(len(parseTitle[0]) + 2, 0) # Reseting file position to right before title
else:
fw.write(writeHTMLHeader(newHTMLFile)) # HTML header as filename (for no title)
fo.seek(0, 0) This can be copied from the
Since we're adding a new feature it would need to be described in the README so please update it with new information regarding the support of After fixing these additional small issues and testing please update the issue-8 branch and if these are fixed this PR will be merged thanks. |
New update and corrected issues
|
Fixes #8 |
Created a new funciton titled markdownfeat , write_MD_to_html ,markdown_to_html_links and convertMD
I did not change anything instead I added a new conditional statement in the main function
this process the md files
convertMD - is the initial convertion MD files to html this takes
markdownfeat - is the process of changing the syntaxes of
markdown_to_html_links - is the process tjat propely place the link ito an HTML syntax
write_MD_to_html - creates the document ready to be written to the html file