How to add PDF as a new Option to the Tiddler Type Dropdown

Here’s one exception— type: application/pdf

Lots of non-programmer folks may be using TiddlyWiki to curate PDFs.

And I need to enter that string manually every single time I set the _canonical_uri field so that it points to a hosted pdf file. (Actually, I end up cloning an existing tiddler as a cheap workaround, but still…)

Of course, my first preference would be to have that option listed by default. But being able to add it as a selectable within a drop-down would be second-best.

Meanwhile, YES to the OP suggestion about pulling the default location of the type selector upwards, and making it a just a drop down selector by default.

-Springer

You should probably bring this up as a feature request. But regardless, or at least meanwhile, I’m sure someone can help you to make application/pdf be one of the items showing in the list. (I took a quick look but failed…)

Hi @Springer,

I knew I had seen some code for this, in the documentation of the Mermaid plugin.
Here is a link to the instructions.
I hope you’ll be able to adapt them to your use case.

Fred

@tw-FRed, Perfect!

To save time for others with the same interest (in getting application/pdf into the Type dropdown list), the resulting tiddler looks like this:

title: $:/language/Docs/Types/application/pdf
description: PDF viewer
group: Image
name: application/pdf

I stuck it under the Image group for compactness, but since the _canonical_uri field could point to other complex resources, perhaps another group, such as “Frame” or “Portal” could serve better as the home for this. Presumably, something like this type-specification could also be done for the .docx viewer as recently shared by @talha131.

2 Likes

That’s the right group. At startup TW registers .PDF file extension as an image type.