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

Multi-line notes are improperly formatted #253

Open
Thiago-Morais opened this issue Sep 3, 2024 · 1 comment
Open

Multi-line notes are improperly formatted #253

Thiago-Morais opened this issue Sep 3, 2024 · 1 comment

Comments

@Thiago-Morais
Copy link

Thiago-Morais commented Sep 3, 2024

Related to #23 but for notes

When a multi-line note is rendered inside a quote block it ignores the new lines within the note so no new > are inserted and the formatting looks wrong
image

The first line is displayed inside the quote block but the following ones don't add a > per new line so anything after the first line is badly formatted


This is the template I'm using:

# {{{title}}}
{{{#description}}}
{{{description}}}
{{{/description}}}
{{#highlights.length}}
## Highlights

{{#highlights}}
> [!QUOTE]+ Highlighted on {{{dateHighlighted}}}
> 
> {{{text}}} [⤴️]({{{highlightUrl}}}) {{#labels}} #{{name}} {{/labels}} ^{{{highlightID}}}
{{#note}}

> {{{note}}}
{{/note}}

{{/highlights}}
{{/highlights.length}}

It is inspired off the Raindrop Highlights plugin that uses this Nunjucks template:

{% if is_new_article %}# {{title}}
{% if excerpt %}
{{excerpt}}
{% endif %}
## Highlights
{% endif -%}{% for highlight in highlights %}
{% if highlight.color == "red" -%}
    {%- set callout = "danger" -%}
{%- elif highlight.color == "blue" -%}
    {%- set callout = "info" -%}
{%- elif highlight.color == "green" -%}
    {%- set callout = "check" -%}
{%- else -%}
    {%- set callout = "quote" -%}
{%- endif -%}
> [!{{callout}}]+ Updated on {{highlight.lastUpdate}}
>
> {{highlight.text.split("\n") | join("\n>")}}
{% if highlight.note -%}> > {{highlight.note + "\n"}}{%- endif %}

{%- endfor -%}
@levidcd
Copy link

levidcd commented Sep 10, 2024

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants