Shortcodes

Joshua Yu November 24, 2024 Updated: February 07, 2025

Here is an example thing holy moly

Highlights

Not a shortcode but still useful. You have several colours to choose from:

See below for Markdown syntax used for the custom shortcodes used in this website.

Re: nesting shortcodes

The below code does not work:

{% warning(header = "warning header") %}

{{ warning_box_only(body="# nested warning!") }}

{% end %}

It will instead throw this error:

Error: Reason: Failed to render 'shortcodes/warning.html'
Error: Reason: Filter call 'markdown' failed
Error: Reason: Failed to render markdown filter: Failed to render warning_box_only shortcode

Caused by:
    0: Failed to render 'shortcodes/warning_box_only.html'
    1: Filter 'markdown' not found

Calling {{ warning_box_only(body="nested warning!") }} is essentially asking to inject html in place of the shortcode. However, if you look at warning_box_only.html:

<blockquote class="warning_box_only">
  <div class="content">
    {{ body | markdown | safe }}
  </div>
</blockquote>

it is expecting the body to be MARKDOWN, not HTML. If you remove the markdown filter from warning_box_only.html, then it will work -- but the markdown within the warning_box_only will not be rendered properly.

Custom boxes

important

{% important(header = "important header") %}
test
Press <kbd>CTRL+ALT+Delete</kbd> to end the

So it turns out you CAN put shortcodes inside other shortcodes, but it cannot be the % % with a body type.
{{ contributors(authors=["Alice Smith", "Bob Johnson"], editors=["Charlie Brown"], staff_reviewers=["David Lee"]) }}
{% end %}
important header

test Press CTRL+ALT+Delete to end the

So it turns out you CAN put shortcodes inside other shortcodes, but it cannot be the % % with a body type.

Authors:
<span class="contributor">Alice Smith</span>, 

<span class="contributor">Bob Johnson</span>
Editor:
<span class="contributor">Charlie Brown</span>
Staff Reviewer:
<span class="contributor">David Lee</span>

warning

{% warning(header = "warning header") %}
This is a warning section.

Here is an attempt at the % % nested shortcode.
{% important_box_only() %}
important bx only!!!
{% end %}
{% end %}
warning header

This is a warning section.

Here is an attempt at the % % nested shortcode.

important bx only!!!

question

{% question(question= "this is the question. now lets make it very long to the point where it probably needs to wrap around because its so large and fat and i hope this doesn't look bad.<br><br>1) this or that<br>2)this") %}

This is the question answer

{% end %}
QUESTION

this is the question. now lets make it very long to the point where it probably needs to wrap around because its so large and fat and i hope this doesn't look bad.

1) this or that
2)this

important_box_only

{% important_box_only() %}

important bx only!!!

{% end %}

important bx only!!!

warning_box_only

{% warning_box_only() %}

warning box only content

{% end %}

warning box only content

admonition

Credit to tabi for the styling. It's more pleasant colour scheme wise and it changes with the light/dark mode. Options for type/icon: note, tip, info, warning, danger, pearl, question (only the icon)

These can be mixed and matched.

{% admonition(type="danger", icon="danger", title="Warning DANGER") %}
This is a danger admonition with a danger icon.

**Markdown can be used here :)**
{% end %}
DANGER

This is a danger admonition with a danger icon.

Markdown can be used here :)

DANGER

There's also a FLAG icon you can add as well!

WARNING

Blah blah here is a wall of text wall of text Blah blah here is a wall of text wall of text Blah blah here is a wall of text wall of text Blah blah here is a wall of text wall of text

INFO

BLah blah

TIP

Blah blah

NOTE

blah blah

question icon

blah blah

We also have the elusive pearl mode:

{% admonition(type="pearl", icon="pearl", title="PEARL") %}

Insert sage clinical pearl

{% end %}
PEARL

Insert sage clinical pearl

text_image

Of note; you cannot nest a shortcode easily within a shortcode. Ie. I could not use {{ shortcode }} within the text image to right text.

{% text_image(src="/images/example.png", alt="An image description", caption = "test caption") %}

_Here is some text_ on the left.</br><kbd>CTRL+ALT+Delete</kbd>

{% end %}

Here is some text on the left.
CTRL+ALT+Delete

An image description

test caption

{% text_image(text_position = "right", src="/images/example.png", alt="An image description", caption = "test caption") %}

_Here is some text_ on the right.</br><kbd>CTRL+ALT+Delete</kbd>

{% end %}

Here is some text on the right.
CTRL+ALT+Delete

An image description

test caption

two_columns

{% two_columns() %}
Left column text goes here.

### Markdown should be supported

<!-- split -->

Right column text goes here.
{% end %}

Left column text goes here.

Right column text goes here.

two_columns_fancy

{% two_columns_fancy() %}
Left column text goes here.

<!-- split -->

Right column text goes here.
{% end %}

Left column text goes here.

Right column text goes here.

spoiler

this is a spoiler that you can click: {{ spoiler(body="text to hide", fixed_blur=false) }}

this is a spoiler that you can click:

You can also use it like so (fixed_blur = true means you can't see it ever):

{% spoiler(fixed_blur = true) %}

testing this

{% end %}
{% dropdown(header="this is what the user will click on to get more info") %}

This text will appear in the dropdown

And it will **LOOK GOOD** with markdown!
<a href="allergyguide.ca">link</a>

{% admonition(type="danger", icon="danger", title="DANGER") %}
This is a danger admonition with a danger icon.

**Markdown can be used here :)**

{% end %}

{% end %}

contributors

{{ contributors(authors=["Alice Smith", "Bob Johnson"], editors=["Charlie Brown"], staff_reviewers=["David Lee"]) }}
Authors: Alice Smith, Bob Johnson
Editor: Charlie Brown
Staff Reviewer: David Lee

timeline

Adapted from the excellent pico theme.

{% timeline() %}

[{
"title":"Lorem Ipsum Event",
"body":"Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
"date":"Jul-2023"
},
{
"title":"Lorem Ipsum event 2",
"body":"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.",
"date":"Jun-2022"
}]

{% end %}
  • Lorem Ipsum Event

    Lorem Ipsum is simply dummy text of the printing and typesetting industry.

  • Lorem Ipsum event 2

    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.

mermaid

{% mermaid() %}
sequenceDiagram
Alice ->> Bob: Hello Bob, how are you?
Bob-->>John: How about you John?
Bob--x Alice: I am good thanks!
Bob-x John: I am good thanks!
Note right of John: Bob thinks a long<br/>long time, so long<br/>that the text does<br/>not fit on a row.

    Bob-->Alice: Checking with John...
    Alice->John: Yes... John, how are you?

{% end %}
sequenceDiagram Alice ->> Bob: Hello Bob, how are you? Bob-->>John: How about you John? Bob--x Alice: I am good thanks! Bob-x John: I am good thanks! Note right of John: Bob thinks a long<br/>long time, so long<br/>that the text does<br/>not fit on a row. Bob-->Alice: Checking with John... Alice->John: Yes... John, how are you?

Other examples of mermaid charts (taken from their docs):

gantt dateFormat YYYY-MM-DD title Adding GANTT diagram functionality to mermaid excludes weekends %% (`excludes` accepts specific dates in YYYY-MM-DD format, days of the week ("sunday") or "weekends", but not the word "weekdays".) section A section Completed task :done, des1, 2014-01-06,2014-01-08 Active task :active, des2, 2014-01-09, 3d Future task : des3, after des2, 5d Future task2 : des4, after des3, 5d section Critical tasks Completed task in the critical line :crit, done, 2014-01-06,24h Implement parser and jison :crit, done, after des1, 2d Create tests for parser :crit, active, 3d Future task in critical line :crit, 5d Create tests for renderer :2d Add to mermaid :until isadded Functionality added :milestone, isadded, 2014-01-25, 0d section Documentation Describe gantt syntax :active, a1, after des1, 3d Add gantt diagram to demo page :after a1 , 20h Add another diagram to demo page :doc1, after a1 , 48h section Last section Describe gantt syntax :after doc1, 3d Add gantt diagram to demo page :20h Add another diagram to demo page :48h

widget_penfast

{{ widget_penfast() }}

PEN-FAST

F - Five years or less since reaction
A - Anaphylaxis or angioedema
S - Severe cutaneous adverse reaction
T - Treatment recieved for reaction (or unsure)

CALCULATED RISK:

wide_contact_card

{{ wide_contact_card(title="example title", text = "test text", src="/images/example.png", url="/research/") }}

custom_macro

{% custom_macro() %}

Here is a custom macro copy paste section

{% end %}
Here is a custom macro copy paste section

load_macro

{{ load_macro(topic_name = "chronic_rhinosinusitis") }}
nasal congestion/fullness facial pain/pressure/fullness anterior or posterior nasal drainage (?purulent) hypo/anosmia change in voice cough headache fatigue/disruption of sleep halitosis/dental pain ear pain/fullness duration CT/ENT before? Known nasal polyps? ? asthma/COPD, AR, CF, NERD/ASA sensitivity, recurrent infect, EtOH induced worsening of upper airway disease, impaired cilia(CF, PCD), smoking, pollution, occupational exposure, nasal anatomic variations, vasculitis Treatment trials SNOT-22 Score # Chronic rhinosinusitis (CRS) wNP sNP AFRS Their clinical picture is suggestive of CRS, an inflammatory syndrome defined by objective structural evidence of sinus inflammation and ≥2 cardinal symptoms (nasal congestion, facial pain/pressure, anterior/posterior nasal drainage, absent/reduced smell) ≥12 weeks. While chronic, regular pharmacotherapy can usually control symptoms well. Recommendations: - CT sinuses (non-contrast) vs ENT referral - SPT for common aeroallergens - Ad-hoc testing: ie. B-cell immunodeficiency workup in setting of suspicious symptoms / acute recurrent sinusitis - High volume nasal saline rinses, avoidance of triggers - INCS + treatment of any underlying causes - Consider short course prednisone for symptom management (most evidence for CRSwNP or AFRS) - Consider oral antibiotics for acute exacerbations (controversial) - Consider biologics for CRSwNP if severe/failed first-line therapy - Follow-up: ~3-4 months

medications_toml_load

param: meds (list of str) if not provided default will show all medications from the toml

{{ medications_toml_load(meds=["bilastine"]) }}
Rx

Bilastine

Brand Names: Blexten

Routes: 10 or 20mg tab, 2.5mg/ml liq (uncommon)

MoA: 2nd gen H1 receptor antagonist

Half-life: ~15 hours

Time to peak action: ~1h, rapid absorption

Doses:

  • CSU, AR:
    • 20mg PO OD to QID (ages ≥12)
    • 10mg PO OD to QID (ages 4-11)

Cost: ~$1.1 CAD / 20mg tab (ON)

Coverage: ON (ODB)

Age Group: ages ≥4

Pregnancy: Avoid (not enough data)

Contraindications: Hypersensitivity, QT prolongation or history of torsades

Common SEs: QT prolongation (at 100mg ODx4, max mean increase 6ms); drowsiness/headache ~4%[D], ~3%[P]; abdo pain 3%[D], 3%[P]

Severe SEs: Torsades (extremely rare; only 1 case reported in monograph post-market reactions)

Monograph Links:

Abbr.
CSU-chronic spontaneous urticaria; AR-allergic rhinitis

Pearls

  • Theoretically does not cross BBB; less sedating than other AHs

  • No renal adjustments needed; minimal data with hepatic impairment but not expected to cause issues

  • Going beyond OD is technically off-label

  • Take without food or juice otherwise absorption impaired

ExRx: Blexten 10mg OD to QID {% popup(icon="rx") %}

{{ medications_toml_load(meds=["bilastine"])}}

{% end %}

Accepts parameter icon which is similar to the admonition icons, but a couple of added options (default: 'rx'). These include:

capsule
capsule-pill
rx
note
tip
info
warning
danger
pearl
question
flag
popup

To be interactive/work, this shortcode requires one script tag to be placed at the bottom of the page:

<script src="/js/popup.js"></script>

ExRx: Blexten 10mg OD to QID

wip

{{ wip() }}

This page is a work in progress. If you want to help contribute, see below :)

Contribute
Z Z

remote_text

{{ remote_text(src="https://raw.githubusercontent.com/jay-joshy/allergyguide/refs/heads/main/TODO.md") }}
## Content

- guideline compilation section (not sure if there's a way to automate this unfortunately)
- Allergic rhinitis seasonal calendar for allergens?
- creation of video resources if time permits
- Billing tips (would have to be province specific -- VERY fellow focused)

## Shortcodes

- port original pen-fast questions over with extra options; need to see if .PDF js packages are possible.
- Finalize medication card specs. Ie. format for age to be used. Right now it's not consistent.

## Misc

- Reach out to staff re: supporting the project / funding -- once example pages completed and overall structure of site more solidified
- main staff TBD
- other editors/contributors -- TBD
- team structure?

references

This sentence needs two references <span class="references">1,2,3,1,1,1</span> and some of this

Here is another sentence with one reference <span class="references">2</span>

... rest of the document content

{% references(showBib = true) %}
[{
"id": "1",
"bib": "Netting MJ, Campbell DE, Koplin JJ, et al. An Australian Consensus on Infant Feeding Guidelines to Prevent Food Allergy: Outcomes From the Australian Infant Feeding Summit. Journal of Allergy and Clinical Immunology: In Practice. 2017;5(6):1617-1624. doi:10.1016/j.jaip.2017.03.013",
"url": "https://pubmed.ncbi.nlm.nih.gov/28499774/",
"notes": ""
}, {
"id": "2",
"bib": "Khan DA, Banerji A, Blumenthal KG, et al. Drug allergy: A 2022 practice parameter update. Journal of Allergy and Clinical Immunology. 2022;150(6):1333-1393. doi:10.1016/j.jaci.2022.08.028",
"url": "https://www.jacionline.org/article/S0091-6749(22)01186-1/fulltext",
"notes": "This study was good!"
}, {
"id": "3",
"bib": "Another reference here with its own details.",
"url": "https://example.com",
"notes": ""
}]

{% end %}

This sentence needs two references the world,2,3,1,1,1 and some of this

Here is another sentence with one reference 2

... rest of the document content

×
1. Netting MJ, Campbell DE, Koplin JJ, et al. An Australian Consensus on Infant Feeding Guidelines to Prevent Food Allergy: Outcomes From the Australian Infant Feeding Summit. Journal of Allergy and Clinical Immunology: In Practice. 2017;5(6):1617-1624. doi:10.1016/j.jaip.2017.03.013. Link.
2. Khan DA, Banerji A, Blumenthal KG, et al. Drug allergy: A 2022 practice parameter update. Journal of Allergy and Clinical Immunology. 2022;150(6):1333-1393. doi:10.1016/j.jaci.2022.08.028. Link.
3. Another reference here with its own details.. Link.

mobile_warning

This will display a warning admonition if viewed from Mobile.

{{ mobile_warning() }}

json_to_table

{% json_to_table() %}

[
{ "name": "Bob", "age": 21, "isCool": false },
{ "name": "Sarah", "age": 22, "isCool": true },
{ "name": "Lee", "age": 23, "isCool": true }
]

{% end %}

research_card

{{ research_card(paper="sygma2") }}
The quick facts - SYGMA2
Clinical Question Is PRN budesonide–formoterol noninferior to daily maintenance budesonide therapy in reducing severe asthma exacerbations for mild asthma?
Study Type 52 week double-blind, randomized, multi-center, phase 3, non-inferiority trial
Population 4176 patients with mild persistent asthma (≥12 years) were analyzed, including those with previously controlled and uncontrolled symptoms on minimal therapy.
Intervention Twice-daily placebo + PRN budesonide–formoterol (200μg/6μg).
Comparison Regular BID budesonide (200μg) + as-needed terbutaline (0.5mg).
Outcomes At 52 weeks, the PRN budesonide–formoterol group had an annualized rate of severe exacerbations of 0.11 events/patient-year compared to 0.12 events/patient-year in the budesonide group (RR 0.97; upper one-sided 95% CI, 1.16). ACQ-5 score improved by 0.35 in the as-needed group versus 0.46 in the maintenance group (Δ0.11 units; 95% CI, 0.07 to 0.15; p<0.001). Median daily inhaled glucocorticoid exposure in the as-needed group was 66μg vs 267μg in the maintenance group.
Bottom Line For mild asthma, PRN budesonide–formoterol was noninferior to daily budesonide in preventing severe exacerbations, with a relatively smaller improvement in ACQ-5 and much less overall steroid exposure.
D1 D2 D3 D4 D5 Overall RoB
Severe ex. rate
+
+
+
+
+
+
{{ research_card(paper="sygma2", show_title=false) }}
Clinical Question Is PRN budesonide–formoterol noninferior to daily maintenance budesonide therapy in reducing severe asthma exacerbations for mild asthma?
Study Type 52 week double-blind, randomized, multi-center, phase 3, non-inferiority trial
Population 4176 patients with mild persistent asthma (≥12 years) were analyzed, including those with previously controlled and uncontrolled symptoms on minimal therapy.
Intervention Twice-daily placebo + PRN budesonide–formoterol (200μg/6μg).
Comparison Regular BID budesonide (200μg) + as-needed terbutaline (0.5mg).
Outcomes At 52 weeks, the PRN budesonide–formoterol group had an annualized rate of severe exacerbations of 0.11 events/patient-year compared to 0.12 events/patient-year in the budesonide group (RR 0.97; upper one-sided 95% CI, 1.16). ACQ-5 score improved by 0.35 in the as-needed group versus 0.46 in the maintenance group (Δ0.11 units; 95% CI, 0.07 to 0.15; p<0.001). Median daily inhaled glucocorticoid exposure in the as-needed group was 66μg vs 267μg in the maintenance group.
Bottom Line For mild asthma, PRN budesonide–formoterol was noninferior to daily budesonide in preventing severe exacerbations, with a relatively smaller improvement in ACQ-5 and much less overall steroid exposure.
D1 D2 D3 D4 D5 Overall RoB
Severe ex. rate
+
+
+
+
+
+

tabs

{% tabs() %}

<!-- TAB -->Overview
<!-- CONTENT -->
<p>This is an <strong>overview</strong> of the feature.</p>

<!-- TAB -->Details
<!-- CONTENT -->
<ul>
  <li>Fast</li>
  <li>Secure</li>
  <li>Reliable</li>
</ul>
{% admonition(type="danger", icon="danger", title="DANGER") %}
This is a danger admonition with a danger icon.

**Markdown can be used here :)**
{% end %}

<!-- TAB -->Pricing
<!-- CONTENT -->
<p>Starting at <em>$9.99/month</em>.</p>

{% end %}

Requires a script to be placed in the bottom of the page:

<script src="/js/tabs.js"></script>

This is an overview of the feature.

  • Fast
  • Secure
  • Reliable
DANGER

This is a danger admonition with a danger icon.

Markdown can be used here :)

Starting at $9.99/month.