You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some of the code from the ConvertMdToHtml function and from the ConvertTextToHtml function has been reused. Mainly the htmlBuilder code has been reused. I'd suggested cleaning it up by making a function to create the start of the HTML file.
For example:
publicstatic StringBuilder HtmlCreator(title){StringBuilderstartOfHtml=new();
startOfHtml.AppendLine("<!DOCTYPE html>")// rest of the start of the html file below
return startOfHtml;}
This doesn't just help cleanup code but also makes modifying the start of the HTML file easier. Since you will only have to make the change in one place.
The text was updated successfully, but these errors were encountered:
Great suggestion. However, I went a slightly different route. The logic to build the HTML output is moved to a new function, and the processing logic for .txt and .md files have been broken off into their respective functions. These new functions return the body content of the HTML. So, now the input text content is processed based on the file extension and then passed down as an argument to the new function that build the HTML output.
Some of the code from the ConvertMdToHtml function and from the ConvertTextToHtml function has been reused. Mainly the htmlBuilder code has been reused. I'd suggested cleaning it up by making a function to create the start of the HTML file.
For example:
This doesn't just help cleanup code but also makes modifying the start of the HTML file easier. Since you will only have to make the change in one place.
The text was updated successfully, but these errors were encountered: