How to enable Prism on DT 3.5?

Yes, include the following html line after the header that calls the prism files.

  • be sure the Line Numbers plugin is included in both the js and css file.
<section class="line-numbers">

2 Likes

Yeah I guess thats doable. Could create a “code snippet” template.

@MosCool_Noel, that’s fantastic!

works like a charm, thx for sharing!

Z

I have such a thing myself. :slight_smile:

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>
1 Like

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 “ ”

1 Like

That did the trick. Thank you very much! This will really help me organize my work notes. :smile:

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.

Good idea. I used KM to do same for the MAC now. But i really wonder if there is a way to select text on IOS and then use some magic to bake it into a proper md note with prism support directly in DTTG. This would open a way to sync this later with e.g. Anki specifically for code snippets.

@jasonekratz I like your idea.

I have used a local copy of JavaScript and CSS files that I linked into markdown. It is not my preferred solution.

Providing a way for users to add their JavaScript and CSS files to the Application Support folder would be better because it would not require us to alter existing and new documents with links to custom files. Some of us have many existing markdown files and hope to have many more.

The ideal solution would be to have a file in the Application Support folder that is always included when a markdown file is rendered by DEVONthink. The file could be empty by default and thus would not alter behavior unless action was taken by the user. A user could include links in that file to their own prism.js and prism.css. Those custom prism files could reside in this same location in Application Support as the include file. This would permit the customizations to persist over upgrades (much like they would if they were stored in a DEVONthink database). It would also permit us to share the markdown rendering across many DEVONthink databases since the files are equally available to all the open DEVONthink databases. This would also allow users to include other files beyond prism. Who knows what kind of amazing customizations users could include in their markdown files?

The key for me, for this include file suggestion, is being able to change the rendering of my markdown files without having to alter the sources.

2 Likes

See here Prism with iOS Siri Shortcuts

Thank you for sharing @MosCool_Noel

Do you have the idea how to see PRISM preview of eg. Python snippet in colors after clicking a file with spacebar?

At the moment it works perfectly in a preview of already opened file. But it would be nice to see a rendered text just in a quick preview with spacebar…

Many thanks in advance :slight_smile:
Andy

No this will not work. Apple’s QuickLook plugin, used when you press the Spacebar, doesn’t support it.

Thanks.

Once upon a time I’ve installed:


but it didn’t work… Installation seemed to be OK, but QuickLook didn’t show me a color syntax.

Andy

1 Like