Reading a how-to and hit a tall sample that shoves the next section off the screen? On every JM Tech Power article detail page, code blocks longer than 12 lines start collapsed behind a Show more control. Expand when you need the full sample; fold it away again with Show less.
How to use it
- Open an article with a long sample. Browse from
https://jmtechpower.com/articles and open a post that includes
a tall
pre/ fenced block. - Look under the code block. Blocks over the line
threshold show a Show more button (class
ja-code-expand) under the collapsed preview. - Press Show more. The wrap drops
is-collapsed, the accessible state flips to expanded, and the label becomes Show less. Press again to collapse.
What stays available
- Copy still copies the full block. The corner
Copy control (
ja-copy-code) always copies the entire sample — collapsed or expanded — not just the visible lines. - Short blocks stay open. Samples of 12 lines or fewer never get the expand control; only longer ones start collapsed.
- Print expands everything. Print styles hide
.ja-code-expandand clear the collapsed max-height so paper and PDF copies show the full code.
Good to know
- Chinese labels too. With the Chinese locale the button reads 显示更多 when collapsed and 收起 when expanded.
- No account required. Guests and signed-in readers both get the same collapse behaviour on public articles.
- Not the same as Copy. Copy puts the snippet on your clipboard; this tip is about keeping long samples from dominating the page while you read.
Browse articles at https://jmtechpower.com/articles, or go home at https://jmtechpower.com/.
Comments (0)
Please login to post comments
LoginNo comments yet. Be the first to comment!