Syntax highlighting

Please add syntax highlighting to code snippets, also provide an option to disable hyperlink in these code blocks.

You’ll be happy to know this is now available in Agenda 15!

Thanks for the feedback!

Very nice to see this in 15! Can you please include Elixir in the available languages?

There are a bunch of popular languages included in the menu, but the total list is much longer, and can be accessed using the text format (three back ticks and then the name of the language). It could be that Elixir is already there.

Ah, so it is! Thank you :slight_smile:

Is it possible to modify the syntax colors, and is it possible to add in custom highlighting for an unlisted format? I do a good deal of switch configuration and would love to be able to see this for switch configs.

No, it’s currently not possible to change the theme. Note that the list of supported languages is much longer than just the menu if you use the trick mentioned here: Markdown Cheat Sheet where you add the language abbreviation after 3 back ticks

1 Like

Appreciate the comment. I’ve been attempting to use the syntax highlighting and have had a few issues. One, I have many pre-existing code snippets and/or batch switch configs that I have kept in Bear (also tried Obsidian) and they work great for that but, it only accounts for a fraction of what I do. Agenda is more well rounded for my needs. However, in this matter, I do as you said and type the 3 backticks and have tried numerous times to bring my content over but, can’t do it. If I paste in the following:

``` actionscript
enable
config
mac address-table static 0100.5E00.00E6 vlan 1675 interface Te1/0/25-28,Gi1/0/1-24,Gi1/0/29-52
mac address-table static 0100.5E00.00E7 vlan 1675 interface Te1/0/25-28,Gi1/0/1-24,Gi1/0/29-52
mac address-table static 0100.5E00.00E8 vlan 1675 interface Te1/0/25-28,Gi1/0/1-24,Gi1/0/29-52
mac address-table static 0100.5E00.00E9 vlan 1675 interface Te1/0/25-28,Gi1/0/1-24,Gi1/0/29-52
mac address-table static 0100.5E00.00FB vlan 1675 interface Te1/0/25-28,Gi1/0/1-24,Gi1/0/29-52
end
write
y

… then I get this in Bear 
![image|577x500](upload://oYwes8UG6YOYaiRoNaVfZhYsf4m.jpeg)

However, when I copy paste it into Agenda, all the formatting is gone.  Not wanting to type out the whole script again, I highlight the whole section and am only able to select from a few code choices but, am not able to manually type in another supported by highlight.js.  It only formats the first line of existing code.

Is there a way for me to bring in my existing snippets and format to say, Cisco or some other unlisted type?

In Agenda 16 we have added the option to use Edit > Paste As > Preformatted does this work for bringing in the code snippets?

Yes except for the code types not in the list. So I’m trying to paste in non listed code types but they are within highlight.js

Does it work if you use the following work around:

  1. type ```actionscript (note that there cannot be a space between the three ticks and the name of the language), followed by a return

  2. paste the code using Edit > Paste As > Plain Text

That did work for me. I wasn’t pasting correctly. All good now. Only request I can think of here are two:

  • I’d like to be able to customize the colors (even if within a file .js, etc…)
  • I’d like for the code to show in a block and to be able to manually specify the end with 3 closing tics ```

Other than that, this is great. Thanks.

Hello, is it possible to assign a favourite language which will automatically be used for the syntax highlighting? As a workaround I tried assigning the Keyboard shortcut cmd, control, 5 to “Python”, but somehow did not hit the correct menu command- do you know what I may have done wrong?

Not at the moment but would make a lot of sense, we’ll see how this could be achieved.