Many of us know the African proverb "It takes a village to raise a child."
The same can be said about programming. It takes a community to develop good, efficient, and useful apps.
This week, for our lab 2 we had to fork a classmates repository, and implement support for markdown files in their Site Generator. I'm really bad with RegEx, so I was already nervous about the implementation using that. Luckily, a class mate opened discussion about some of the expressions that could be used - and even provided a good explanation to it!
Forking a repository
I forked the repository and alongside I filed an issue to support markdown files. When reading through the code, I found it difficult to follow along as we both had different coding styles - especially the amount of new lines. I don't know why, but I found that really hard to read through. the changes I made were simple. There was already implementation of a conditional statement for whether the file was .txt or not. I simply added an "if else" to check for .md extensions. From there I created a function to create HTML from the markdown styles.
Creating a PR
Once I pushed and created the PR, I realized there was a bug. The title of the HTML produced was incorrect. I understood that if the first line in the file had any markdown formatting, it was going to be applied to the HTML equivalent AND have the title formatting. To solve this I created a function that would cleanse markdown formatting, hence receiving the text only.
When I created the PR, as I already had experience with this, I took more time into making it readable and clear. I went back a few times to edit the comment to make sure all the details were there.
Reviewing a PR
In addition to the issue and PR I created, I received a PR for my repository also! I was shocked at how little code was used to implement the markdown support. On a second glance, I realized that all input files were going to support markdown conversion to html, no matter the file extension. I was not too happy about this, and started a review to explain that there was a function which passed the data to create the HTML, and the data that was passed was already able to distinguish between markdown and text files. My suggestion was to make the changes, and hope they are able to create an if/else like I did.
Merge Conflicts
I absolutely get terrified everytime I see there is a merge conflict. It's like receiving a present from a family member on Christmas... are these socks or a really cool toy? You never know how bad it's going to be - but I always expect the worst. Luckily, I know how to deal with them... but very very very slowly.
Lastly, unfortunately the last commit to the PR I created caused a merge conflict. I accidentally used alt+shift+f to reformat one line, which then coincidentally formatted the whole document. I went ahead and pushed this, which I am now thinking was a mistake since I believe it caused merge conflicts. I'm off to fix these now, and hopefully won't be too complicated!
Top comments (0)