DEV Community

Cover image for Merging branches
Tue
Tue

Posted on

Merging branches

In lab 3 of week 4, I was asked to implement some features that supports .md files to my SSG program.

The implementation

Horizontal markdown parsing

This feature was the easiest to carry out with as many as 2 lines of code

    if(param.match(/---/))
      return Object({type: 'hr', content: null});
Enter fullscreen mode Exit fullscreen mode

I simply match any --- and return a hr object(equivalent to <hr>) to be added the my createHTML function.

Inline code markdown parsing

I continued to use regEx to match any 2 backticks and wrap the content between them inside <code>. It can be found here

    param = param.replace(/\`([^\`].+?)\`/g, "<code>$1</code>");
Enter fullscreen mode Exit fullscreen mode

Adding lang attribute to <html>

In my ssg, I've used html-creator npm package to create html string. However, it doesn't have any method that allow me to add a lang attribute to <html> tag. Therefore, I must edit the html string after the I've convert the HtmlCreator object to string.

This step seems to beat the purpose of using the library, I will try to make a pull request implementing this feature to the author's code


Merging feature branches

Creating different branches for different features

In lab 3, I was asked to create branches for different features, it's similar to a few developers branching off the main branch to implement different feature. It was expected to have conflict after the first fast forward merge

Merging

After merging the first issue branch into main, I encountered some conflicts, but the problem was solved by looking at the difference between 2 files and figuring out which change to keep.

Take a look at my merges here and here

Top comments (0)