DEV Community

Cover image for Changelog: Github PR Liquid Tag Support
Glenn Carremans
Glenn Carremans

Posted on

Changelog: Github PR Liquid Tag Support

Last week I made an issue on Github thinking there was a bug with the Github liquid tag because it was giving me an error when I was trying to embed a Github Pull Request.

Error Github PR Embed #1760

Is your feature request related to a problem? Please describe. When trying to embed a Github PR an error message is shown: Invalid Github Repo link

Describe the solution you'd like Github Pull Requests should also be embedded correctly like Github Issues.

Describe alternatives you've considered Replacing pull with issues in the url is a dirty workaround, I assume that adding /pull/ to the Github link validator should be sufficient to add support for this.

Additional context

  • Error with PR url: Error with PR url

  • No error when using workaround: No error when replaced with issues

  • Correct result after applying workaround: Correct result after applying workaround

Then @andy informed me that this wasn't actually a bug but that the Github liquid tag just doesn't support PR URL's. To me this was strange because Github Issues and PR's are very similar and I expected that the liquid tag would also support it.

Sunday I started setting up my Ruby environment, I have no previous experience with Ruby so this was a bit of a challenge but with Google and following the DEV installation documentation I was able to get it all up and running.
I however was confused when I was getting errors in config/application.yml, I copied the sample file exactly as was told in the docs but I didn't know that you had to remove empty/unused config variables.

After that I started hacking away. It was more a trial and error kind of thing than actual development, I had to look up how simple things where done in Ruby and also did a lot of playing around (change something and see what happens, mostly broke it lol).
Eventually I was able to get the expected result and I didn't seem to break the old Github liquid tag behaviour. So at this point I was pretty happy with myself and called it a success.

Now the big surprise (to me) was when I tried to commit, Husky lint-staged pre-commit hook ran over the code and it gave me errors. Now you might think why is this a surprise? Everyone has had a build/lint fail before. Well the big surprise was because it gave me errors on parts of code that I didn't even touch.

So I assume that there have been people in the past that have used --no-verify to commit changes without running the pre-commit hook and didn't follow project standards. I fixed most of the errors but there was an issue with a code block that when I changed it into valid html (to solve the error) it would parse the html instead of showing it in the code block, probably the reason why that person skipped the pre-commit hook (and every person after that).

In the end even tough it is a small change I am happy that I was able to make this PR and again contribute to the DEV community, I hope people think it is a useful change and will use it in their posts.

Now I am waiting until the Pull Request gets reviewed and merged so that I can publish this post without raising an Invalid Github Repo link error.

{% github %}

Added GitHub PR liquid tag support #1784

What type of PR is this? (check all applicable)

  • [ ] Refactor
  • [x] Feature
  • [ ] Bug Fix
  • [ ] Documentation Update


Add support for Github pull request via liquid tags in markdown. {% github %}

My first time setting up a Ruby environment and actually developing in Ruby, so let me know if I should have done things differently.

I also fixed a couple of pre-commit errors, strange that the thrown errors where from parts that I didn't edit. So I assume that a lot of people skip the pre-commit check with --no-verify. Anyways the only error I couldn't fix was this section because it would parse the html instead of showing it in the codeblock:

Related Tickets & Documents

Closes #1760

Mobile & Desktop Screenshots/Recordings (if there are UI changes)


Added to documentation?

  • [x] help tab in the markdown editor
  • [ ]
  • [ ] readme
  • [ ] no documentation needed

[optional] What gif best describes this PR or how it makes you feel?


What are your opinions about the pre-commit hook? Should it be removed (because people already seem to skip it) or should it be enforced more strictly?
Maybe someone from the DEV team can comment about it and open a discussion.

Top comments (1)

rhymes profile image

Good job Glenn. And welcome to the dark side :D