slipshow icon indicating copy to clipboard operation
slipshow copied to clipboard

Add support for syntax highlighting more languages

Open ankhers opened this issue 1 year ago • 2 comments

I was hoping that a simple

```elixir my_code_here() ```

would support syntax highlighting in the generated presentation. Unfortunately that does not seem to be the case. I would love to see this added to slipshow.

I would also be happy to submit a PR for this feature if you would be willing to point me in the right direction. Is this simply a theming issue or is this something that the engine does not yet support?

ankhers avatar Feb 20 '25 19:02 ankhers

Hello, and thanks for your interest in Slipshow!

The issue is that under the hood, Slipshow uses highlightjs, which requires some additional support for syntax highlighting elixir code.

Loading this support makes the highlighting work:

<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/elixir.min.js"></script>

```elixir
iex> "Elixir" |> String.graphemes() |> Enum.frequencies()
%{"E" => 1, "i" => 2, "l" => 1, "r" => 1, "x" => 1}
```

In principle, Slipshow tries to be a self-contained html file which does not require any internet connection. It is not anymore the case when loading a script as such. I'll keep this issue open to remember to try to find a solution for that!

panglesd avatar Feb 21 '25 06:02 panglesd

Thank you for the tip on getting it to work!

Let me know if there is anything I can do here in order to help with whatever solution you come up with!

ankhers avatar Feb 21 '25 16:02 ankhers