Creating callouts with ! and columns in callouts with !- #1066
Djb-Champagne
started this conversation in
Templates Showcase
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
needACallout.js
Callouts are useful and good-looking, seamlessly integrated into Obsidian. Their syntaxe is coherent with the whole Application.
needACallout.js proposes a way to write the callouts differently, coding for us the boilerplate.
Making callouts with the exclamation point (!). Defaults to note
We can even make a note with nothing :
An object defines some property/value pairs :
Letters are toLowerCase transformed. So, I, N, Q, A, ... can be used.
Plus (+) and minus (-) signs are also respected (foldable, opened or closed):
So is the custom title : (space can be avoided. The result is often less readable)
We can nest the callouts with a line feed.
Practical point of view:
trim
s and a regex take out the blanks (defined by the \s of regex).The blank lines outside and inside the selection except the ones defining the nest of callouts are discarded.
Technical point of view :
The needACallout.js is to be put into a TemplateScripts folder
The Template in the Templates folder is : <% tp.user.needACallout(tp) %>
Of course, the parameters of Templater must be defined :
Freedom point of view :
With the
.js
file in hand, it is possible to modify the default_header string so as to default to an info callout or something else, or modify the calloutType object if the q = quote is prefered to q = question.Remark
The result is a pure Obsididan object, markdown compatible.
If you appreciate the very good job done by Trevor Nichols with its 'Obsidian columns' plugin, you can keep on using it inside the callout.
Let's try to make columning simpler with !-
As we saw before, making a selection permits us to change the local rules. The difficulty is to inject something coherent into the Application. This job as been done by Trevor.
Suppose we want to divide the body of the previous warning message into 3 columns.
We keep the 2 first lines : System warning, Some info here
We divide the rest of the callout into 3 columns with some parameters :
Let's see how to write the columns (exclamation point and dash) :
When the width is 1 unit, it's the default. It's not mandatory.
When the width is not 1 unit, the multiplication factor follows, without any space.
The final result is :
The coherent result is :
Beta Was this translation helpful? Give feedback.
All reactions