Code Snippets in Knowledge Base
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2016 02:49 PM
How do we properly display "code snippets" in the Knowledge Base? This will be very useful for software developers or programmers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2017 05:01 PM
Hello Charles,
I know this is a bit late, but I am currently looking for something similar without much luck. Hopefully you already have a solution, but perhaps this could help out other people looking to do the same.
I was able to embed code snippets in a knowledge article (helsinki release) by editing the HTML source code for the article and wrapping my code with the <pre><code></code></pre> tags. Doing this allowed me to enter my formatted code into a box. It is not quite like what you would have on say Slack and does not use colored mark-up, but at least it gave us something, I will update you if I find anything else on the topic.
I also found this website which will build the HTML for you, including syntax.
Source code beautifier / syntax highlighter — convert code snippets to HTML « hilite.me
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-09-2017 10:48 AM
You are correct. I found the solution when we were working in Service Portal where I bumped into bootstrap and flexbox. Both <pre></pre> and <code></code> are based on CSS Bootstrap.
All bootstrap styles are applicable.