eecs485staff / primer-spec

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

Copy button in enhanced codeblock omits whitespace #221

Closed awdeorio closed 1 year ago

awdeorio commented 1 year ago

Describe the bug The copy feature in an enhanced code block omits whitespace. An example of where this produces unxpected results is in the EECS 485 Threads and Sockets in Python tutorial.

To Reproduce Copy a code block containing whitespace from https://eecs485staff.github.io/p4-mapreduce/threads-sockets.html#threads and paste it into a text editor.

Expected behavior Whitespace in the pasted code matches whitespace displayed in the enhanced code block.

seshrs commented 1 year ago

Thanks for reporting! It took me a bit to figure out what's missing: Now I realize that the copied text does not contain newlines! 😅

Minimal repro example code block:

Line 1

Line 3

Result after using copy button:

Line 1
Line 3
seshrs commented 1 year ago

I've fixed this in v1.8.3, which is live! The JS updates automatically, so you should now be able to copy the Python code from the tutorial you referenced in the issue description :)

awdeorio commented 1 year ago

Thanks @seshrs !

EDIT: tested and works