eecs485staff / primer-spec

A Jekyll theme for sites with content-heavy pages
https://eecs485staff.github.io/primer-spec/
MIT License
22 stars 13 forks source link

Hidden lines of code? #185

Open eecs441staff opened 2 years ago

eecs441staff commented 2 years ago

Is your feature request related to a problem? Please describe. Often times one only wants to display several lines of code. Displaying these lines without context could confuse the reader. Displaying them with surrounding lines could lead to reader cut and pasting duplicated code. Is there a way to "hide" contextual lines of code by default but reveal them, properly formatted and syntax highlighted, with the click of a button?

Describe the solution you'd like Like this: https://rust-lang.github.io/mdBook/format/theme/syntax-highlighting.html#hiding-code-lines

Describe alternatives you've considered To show the contextual lines commented out, but then it wouldn't be properly formatted and syntax highlighted and could be confusing.

Additional context Add any other context or screenshots about the feature request here.

seshrs commented 2 years ago

(Sorry for my delayed reply while I've been traveling!)

That's a really interesting feature request. I really like the example you linked to! A couple of my initial thoughts:

I'll give this further thought in the coming weeks.

seshrs commented 2 years ago

Oh this could be as easy as adding a data-hidden-lines attribute 😅

My next question: How does this affect line numbers? Maybe this feature should only be allowed with the no-line-numbers variant? I'll need to give this further thought.