Issue
This week we're contributing to each other's project by adding a new feature that enables the tool to convert a Markdown file to a HTML file. The issue I raised is to add a markdown functionality to the tool, and the tool has a few the Markdown syntax features such as Heading1(2,3) and Italics. Also, one of my goals was to add features without using the existing framework and library on the Internet.
The process of work
While I was implementing the app I tried not to break the existing code, so at the beginning, I read all of the functions and files he created. After that, I slightly made a change to the main function to read the Markdown file and create the HTML file, specifically, I followed the way of reading .txt file and created the function to read .md file using else if statement underneath the existing code. After that, I narrowed down to the function that parsing to HTML file, he already got parseToHtml function but it was for .txt files and I newly created mdParseToHtml function underneath. I used if else statement to try to convert md file functionalities to html tags line by line.
Problem
After I created the PR and talked to the creator, and he reviewed my code and asked me to use let
instead of var
which is outdated and he doesn't like it. Also, at the first PR, my code doesn't read the line in Italics when the line in Italics is between strings, for example, *Italics*
it's working whereas string *Italics* string
it doesn't read the line and it wasn't able to convert the file into HTML file. Based on his comments, I used regex
with match
method to solve the issue.
Learn
Reading other's code was really hard to understand at the beginning, but I found out that he implemented code in another way even though we complemented the same tool, so I would say it's a pretty good chance to learn another approach and the style of coding. Also, through his comments I could solve the issue in another way such as by using regex
, regex
is not really familiar with me, but now I know how to use it.
Top comments (0)