Jekyll Rouge 中的垂直滚动条

Vertical Scroll bars in Jekyll Rouge

有没有办法在 Jekyll 中为非常长的代码添加垂直滚动条?我尝试在 _syntax.scss 中添加一个 Height 属性,但没有成功。我使用的语法荧光笔是 rouge,我使用的主题在这里:https://github.com/mmistakes/hpstr-jekyll-theme

是的,确保将此 CSS 添加到您的主题中:

pre.highlight {
  max-height: 200px; /* Change to your desired max height */
  overflow-y: scroll;
}

更新。 使用此处提供的 OP URL 是我所做的:

查找定义 class 高亮的地方并将其添加到其声明的末尾:

.highlight {
  [...]
  border: 1px solid #dbdbdb;
  background-color: #272822;
  border-radius: 3px;

/** This part **/
  max-height: 300px;
  overflow-y: auto;
}

结果: