romannurik / SlidesCodeHighlighter

A little web app that helps you copy+paste syntax-highlighted code into slide decks.
https://romannurik.github.io/SlidesCodeHighlighter/
Apache License 2.0
1.06k stars 92 forks source link

Support for Microsoft Office PowerPoint #79

Open doggy8088 opened 11 months ago

doggy8088 commented 11 months ago

The SlidesCodeHighlighter is not able to paste code with the right format into PowerPoint correctly.

When I paste code into it, it will become only 1 line.

image

It because PowerPoint can't treat <pre> tag correctly.

I have workaround for this. I learned from Visual Studio Code.

  1. Replace \n as <br>
  2. Replace all the spaces as &#160;.
  3. Wrap each line in the <div> ( don't use <pre> )
mcejp commented 8 months ago

Another workaround: Paste to Word first, and from there to PowerPoint. You will probably need to reset line spacing, but otherwise it works.