gotcha, but zsh isn’t currently supported as well right? would be nice to add either to get CLI syntax in markdown documentation:)
thx
Z
gotcha, but zsh isn’t currently supported as well right? would be nice to add either to get CLI syntax in markdown documentation:)
thx
Z
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.
Go to prism website
Click the big download button at the top
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.
(Prism.plugins.NormalizeWhitespace=new e({"remove-trailing":!0,"remove-indent":!0,"left-trim":!0,"right-trim":!0,"break-lines": 80})
Be sure to check your quotes whenever you copy / paste as the open/close quotes can be copied instead of the general quote used in code
<link href=“x-devonthink-item://0A9B8CBC-D620-4257-B1A8-71E363C0EDBA” rel=“stylesheet”>
<script src=“x-devonthink-item://96C2CDA1-86FE-4DE4-8924-92C7541A432C”></script>
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.
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.
Why don’t you just disable it in the preferences, then link to your own local copy of it?
Yes, include the following html line after the header that calls the prism files.
<section class="line-numbers">
Yeah I guess thats doable. Could create a “code snippet” template.
I have such a thing myself.
Hi @BLUEFROG
Since the DT’s built-in Prism support doesn’t have soft wrapping for fenced code block, is there a way for us to include some header in the markdown to make it happen?
Thanks
You can use a CSS override like this…
<style type="text/css">
pre, code {
white-space: pre-wrap !important;
}
</style>
Thank you very much!
Yep
Hello!
I’m really excited about adding custom Prism support, but I can’t seem to get it to work:
I downloaded the JS and CSS files from Prism’s website (both version 1.20.0), then dragged both into my open Personal database. I copied the item link using the context menu and pasted them into the link/script tags as shown–I checked them more than once to make sure they’re correct.
I noticed that the section tag doesn’t show in the rendered Markdown preview, but the link/script tags do, as though they aren’t being processed. Why might this be?
I checked to make sure I have JavaScript enabled in the Web Content preferences:
Also, built in Prism support is disabled, though checking/unchecking this box had no effect:
Any idea what I’m doing wrong here? I’d appreciate any advice or suggestions. Thanks.
The header section that calls the files has open/close quotes, probably from copy/paste. Retype them to replace them with the general quote that look like this " "
instead of this “ ”
That did the trick. Thank you very much! This will really help me organize my work notes.
Thanks for this.
What is your capture flow?
I wonder how to effectively capture, especially on the IOS (is there a way to create the necessarily boilerplate per shortcut maybe?).
This old discussion suggested to use a service on mac. Is it how you guys use this with prism support?
You may want to start a new thread on how to capture snippets on iOS. I’m mostly on the Mac but if I were on iOS I would look at Text Replacement to expand the prism header on typing a keyword: Look in General > Keyboard > Text Replacement.