How to highlight lines of code step by step in Google Slides
By Jake Marsh · Updated
To highlight lines of code step by step in Google Slides, insert the code with Syntaxwell, then duplicate the slide once for each step. On each copy, click the block, type the lines for that step in Highlight lines (such as 3-5), choose Highlight bar, Dim the other lines or Bar and dim, and press Update block. Clicking through the slides moves the highlight down the code.
Steps
-
Insert the block on a slide: Extensions, Syntaxwell, Open code editor, paste, pick the language and theme, Insert.
-
Duplicate the slide once for each step you'll explain (in the slide list, right-click and choose Duplicate slide).
-
Go to the first copy and click the block. Its code and settings load into the sidebar.
-
Type the lines to highlight. Use numbers and ranges:
2,3-5,3-5, 9. -
Pick a Highlight style:
Style Looks like Good for Highlight bar A colored band behind the lines Pointing at a line while the rest stays readable Dim the other lines Everything else fades Keeping eyes on just those lines Bar and dim Both Large rooms and long blocks -
Press Update block, then repeat on the next copy with the next lines.
Updates are free, so a ten-step walkthrough of one block counts as one block in the trial.
Line numbers that match the file
If the code is an excerpt from line 120 of a file, tick Line numbers and set from to 120. Highlight lines follow the numbers as shown, so 124-126 highlights what's labeled 124 to 126.
Keep the block in one place
Because each copy of the slide holds the same block in the same spot, clicking from one slide to the next looks like the highlight is moving, not like a new slide. Leave the slide transition off, or set it to a short fade.
Docs too
The same highlight options work in Google Docs, for a handout that marks the important lines. In a Doc, a highlighted line's bar runs the full width of the block.
What it costs
Syntaxwell is $2.99 a month or $19.99 a year per Google account. Free trial: 25 code blocks or 14 days, whichever comes first. No card needed. Every plan and the install link are on the Syntaxwell page.
Syntaxwell: Code Highlighting for Slides and Docs
Syntax-highlighted code blocks for Google Slides and Docs, with line numbers, highlighted lines and click-to-edit $2.99 a month or $19.99 a year per Google account.
Questions
Can I highlight lines that aren't next to each other?
Yes. Separate them with commas, such as 2, 6-7, 12.
Does highlighting change the code?
No. Only the colors change. Copy code still copies the plain code.
Can I use a different highlight color?
The bar color comes from the theme, so it matches the block. Changing the theme changes the bar with it.
Is there an animation that steps through lines on one slide?
Google Slides animations work on whole shapes, so one slide per step is the way to move a highlight through a block.