Ketan Bhatt

Home Archive Notes

Using <details> tag on Github easily

March 08, 2022 programming

I am a big fan of using Github issues for taking notes on the steps I am taking while debugging a weird behaviour or verifying some changes I made, or anything else where having a record of the steps I took will help me or someone else in the future.

Github supports HTML <details> tag

These issues tend to become long, specially because I paste logs or outputs of the code I am running. To make the issues (and comments) more readable, I use the HTML <details> tag heavily. This is, thankfully, supported by Github’s flavour of Markdown.

It turns long comments like:

I am going to try and backfill this table.

Running the backfill:

[1] App(DEV)> Backfill.run(from: 2.years.ago)
=> logs.....

....
...
more logs...

SUCCESS

That worked!

to something more readable:

I am going to try and backfill this table.

Running the backfill: (my blog is not rendering the ▶️ properly. Click on the text anywhere to unfurl)
[1] App(DEV)> Backfill.run(from: 2.years.ago)
=> logs.....

....
...
more logs...

SUCCESS

That worked!

Use Text Replacement (or other means) to avoid typing the tags

Even though I use this tag almost 5 times a day, and curse having to type so much to get the tag working, and get confused if it is <details><summary></summary></details> or <summary><details></details></summary> (don’t blame me, they both make sense!), I never tried to improve my situation. Until today.

Today I decided to add a text replacement on my machine that will automatically turn ghdet to the correct syntax. I wrote this post to point people to:

  1. the details tag and encourage them to use it
  2. make it easy for people to use the tag!

You can add a new line character to the text to be replaced by pressing option + return while defining the replacement (yes, the same way you add a new line to any other app where pressing return would not help).

Let me know if you have any suggestions.


Get new posts sent to you

Subscribe to my new work on programming, productivity, and a few other topics. Published once a month.

    Powered By ConvertKit