Using transclusion to add html or css

I remember this came up somewhere before, which also lead me to play around with it. It’s a nice setup: set general preferences in your main stylesheet, but easily override parts of it for certain types of documents.

(… Found it, @vinschger and others discuss it in this thread. It also has some tips if you want to get more advanced in styling your header counters):

Your example not related to styling is interesting for inspiration. But as rkaplan mention, one needs to consider if/when a permanent record is important.

If you are not aware, you can also use MMD metadata as placeholders. Very useful for templates! You can set a key: value in the metadata header, and put ‌[%key] wherever you need it in the body text (one or multiple times). The placeholder is then substituted on render/export.

So you can create templates with a set of predefined metadata, filled out or not as it makes sense. I guess you can even combine this with transclusion.

iA Writer gives this demonstration example (from their help page on metadata):

I never tried but was curious if it works with image links. It seems not, at least I can’t get it to work so far. I tried in DEVONthink with relative links, x-devonthink-item://, and https:// – in different variations of key/placeholder:

key placeholder
logo: ![](https://...) ‌[%logo]
logo: https://... ![]([%logo])
logo: (https://...) ![][%logo]
logo: [](https://...) ![%logo]

But I think this is a minor detail. Most would likely use it for general text.

Edit to add: The official MMD User Guide does say this:

Metadata is processed as plain text, so it should not include MultiMarkdown markup.

So I guess it makes sense that you can’t put a full ![](image-link) in the header. But is a bare URL considered markup? Seems like an edge case.

1 Like