Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

note shortcode: Use title as title when specified #1120

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions common-content/en/module/js1/interpreting-errors/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ Your output was probably different. But it will have the same parts. Some text,

{{<note type="exercise" title="Exercise">}}

Work out what the parts of this line mean.
1. Work out what the parts of this line mean.

Why are they different on my computer than yours?
2. Why are they different on my computer than yours?

How can we use both pieces of information?
3. How can we use both pieces of information?

{{</note>}}

Expand Down Expand Up @@ -92,9 +92,7 @@ Node.js v22.4.1

{{<note type="exercise" title="Exercise">}}

What does this line mean?

Why might it be useful to know this information?
What does this line mean? Why might it be useful to know this information?

Add your answer to your spaced repetition calendar. Your understanding of this will grow over time. Answer the question again in the future, and compare it to your previous answer.

Expand Down
4 changes: 2 additions & 2 deletions common-theme/layouts/shortcodes/note.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
"tip" ":bulb:"
"warning" ":warning:"
}}
{{$title := .Get "title" | default "Note"}}
{{$title := .Get "title" | default (.Get "type") | default "Note"}}
{{$noteType := .Get "type" | default "note"}}

<section class="c-note c-note--{{$noteType}}">
<h4 class="c-note__title e-heading__4">
{{ transform.Emojify (index $emojis $noteType) }}
{{ or (i18n $noteType) ($noteType) }}</span>
{{ or (i18n $noteType) ($title) }}</span>
</h4>
<div class="c-note__text ">{{ printf "%s" .Inner | markdownify }}</div>
</section>
Loading