Additionally to enabling Prism.js in Markdown (Media tab in settings) you need to make sure that “Enable JavaScript” is checked in the Web tab in the settings.
Also I noted that for example language-sql doesn’t seem to work for me (while swift does). But sql is a supported tag by prism. Any idea why this is happening?
EDIT: Supported languages from the release notes:
Currently AppleScript, Objective-C, Swift, C, C++, Java, and JavaScript are supported.
Not all languages are supported, see release notes. Otherwise the embedded Prism files would be much larger and e.g. bloat the code after converting Markdown to HTML.
Correct. And to reiterate Criss’ comment: “Not all languages are supported, see release notes. Otherwise the embedded Prism files would be much larger and e.g. bloat the code after converting Markdown to HTML.”
Devonthink team thanks for the 3.5 update. I feel there’s a need to outline how to use the custom Prism file since it helped me centralize my SQL, Visual Basic, Batch, Powershell, etc. code syntax, snippets and historical versions into DT as opposed to having them scattered across two other apps and Outlook folders. Code-block works on both Devonthink Mac and iOS as shown below using this method.
Check off the theme and languages you will be using
(Optional) Check off plugins like Inline Color, Normalize Whitespace (for removing extra lines in rendered code), and Copy to Clipboard Button. Unfortunately, Line Numbers didn’t work for me at the time of this writting.
Download both the CSS and Javascript file using the big download buttons on the bottom of the page.
If you are using Normalize Whitespace and want your code to wrap around, insert the “break-line”: 80 line into the javascript file method Prism.plugins.NormalizeWhitespace as shown below.
using the devonthink item link allows you to move the files around the db without breaking the connection
place this at the top of every markdown document where you would like to use the code-block, I use a text expander to automatically insert it by typing .syntax
As mentioned above, prism uses the language-xxxx in the code-block to identify the language you are working with.
The language must be spelled out just like it is listed in the prism website otherwise it will not highlight ie. use language-excel-formula NOT language-excel
Be sure to save the document to see the code-block highlight or when changing from one language to another
Thanks for the comments.
They are find if someone wants to customize their prism experience. The 3.5 build allows use of prism without needing to explicitly link the css and js files, though it only supports a smaller number of all the supported languages.
Question: I see that a generated prism.js is stored in the .app folder structure and that it seems to have the 4 prism defaults with a few extras. Is there a way that at some point in the future that could be in the Application Support (or similar) folder so that it could be overridden with a customer-generated prism.js?
I respect that you guys want to avoid bloat but I also personally don’t care about the bloat for my own purposes in previewing the files. I would love to have a way to generate and use my own customized prism.js that wouldn’t involved putting it in the .app folder and have it being overwritten by updates.