pietroppeter / nimib

nimib 🐳 - nim 👑 driven ⛵ publishing ✍
https://pietroppeter.github.io/nimib/
MIT License
175 stars 10 forks source link

Add: function to add line numbers to block #220

Open dlesnoff opened 7 months ago

dlesnoff commented 7 months ago

This PR is not finished yet. Attempt to fix #101. to do:

I am not satisfied with this generated HTML but at least it renders the numbers correctly.

neroist commented 5 days ago

Why not use something like https://github.com/wcoder/highlightjs-line-numbers.js? Though I'm not sure about the impact on nimitheme...

Using it with this stylesheet works for me:

td.hljs-ln-numbers {
  text-align: center;
  color: #ccc;
  vertical-align: top;
  padding-right: 5px;

  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

td.hljs-ln-code {
  padding-left: 1em;
}

/* Fix for water.css*/
table.hljs-ln {
  width: initial;
  margin-bottom: 0;
}

table.hljs-ln tbody tr:nth-child(2n) {
  background-color: unset;
}