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

Extend blockquote alerts to support Obsidian AlertTitle #12805

Closed
benbarbour opened this issue Aug 29, 2024 · 6 comments · Fixed by #12815
Closed

Extend blockquote alerts to support Obsidian AlertTitle #12805

benbarbour opened this issue Aug 29, 2024 · 6 comments · Fixed by #12815

Comments

@benbarbour
Copy link

benbarbour commented Aug 29, 2024

In addition to custom alert typo (see #12801) it would also be nice to support Obsidian's callout titles too. At least enough for me to use a blockquote render hook to support it. As is, if this markdown is sent to the render hook:

> [!NOTE] Alerts are awesome
> Alerts, as you may have noticed, are an awesome way to callout information to the reader.

The the text "Alerts are awesome" (the "title") is not passed to the render hook at all; it just vanishes. It would be great if the render hook got .AlertTitle or something so I could implement an alert with a title myself, even if the default was to do nothing with it (current behavior).

However, the following illustrates how GitHub handles things.


[!NOTE] Title Test
Title Test 1: I have a title

Note

Title Test 2: I have no title


As you can see, GitHub doesn't even render the blockquote as an alert if there's a title. So maybe Hugo's current behavior should be considered a bug (feel free to change the tag to "bug" if you agree). If a title is present then Hugo shouldn't consider the blockquote to be an alert at all; .AlertType should be empty and .Text should contain the entire contents of the blockquote. Fixing this would allow me to parse the title myself if I want to.

@bep bep removed the NeedsTriage label Aug 29, 2024
@bep bep added this to the v0.134.0 milestone Aug 29, 2024
@bep
Copy link
Member

bep commented Aug 29, 2024

I guess this relates to #12801 ... This feature was added to support "GitHub syntax" which is pretty wide spread. My question for both of these issues are: How big/widespread is Obsidian. I just heard about it days ago, so I'm guessing it's a pretty new product.

@benbarbour
Copy link
Author

benbarbour commented Aug 29, 2024

how big / wide spread is Obsidian?

The first release was in March 2020 so it's not brand new. Other than that I can only answer with anecdotes that sum to "it seems quite popular".

However, I think that this should be split into two issues.

  1. A bug with Hugo's implementation of GitHub alerts. Hugo acts differently than GitHub when there's any text after the square brackets on the first line. GitHub doesn't render an alert (just a normal blockquote), but Hugo does. Worse, Hugo swallows the extra text and it's just gone from both the rendered site and the render hook.
  2. A proposal to add optional support for {.AlertTitle} like Obsidian, but I'd understand completely if supporting Obsidian features is not a goal of this project.

If you want to make this issue the bug I can actually follow the contribution guidelines and start with a feature request on the forum to make a proposal.

@bep
Copy link
Member

bep commented Aug 29, 2024

If you want to make this issue the bug I can actually follow the contribution guidelines and start with a feature request on the forum to make a proposal.

This needs to wait on #12801 - if that gets implemented, then this isn't a bug anymore. I'm not spending any time on a bug now if it becomes a feature tomorrow.

@benbarbour
Copy link
Author

I can see doing the work at the same time, but it's a different issue, isn't it? This bug affects NOTE, TIP, and all the other valid Alert types while #12801 is about adding custom note types.

@bep bep modified the milestones: Unscheduled, v0.134.0 Aug 29, 2024
@bep bep changed the title Alert Titles Extend blockquote alerts to support Obsidian AlertText Aug 29, 2024
@bep bep self-assigned this Aug 29, 2024
@bep
Copy link
Member

bep commented Aug 31, 2024

Testing this, i see these variants:

> [!tip] Callouts can have custom titles
> Like this one.

> [!tip] Title-only callout

> [!faq]- Are callouts foldable?
> Yes! In a foldable callout, the contents are hidden when the callout is collapsed


> [!faq]+ Are callouts foldable?
> Yes! In a foldable callout, the contents are hidden when the callout is collapsed


> [!question] Can callouts be nested?
> > [!todo] Yes!, they can.
> > > [!example]  You can even use multiple layers of nesting.

So, I suggest we add:

  • AlertTitle
  • AlertSign (+,- or empty)

Above rendered by GitHub

[!tip] Callouts can have custom titles
Like this one.

[!tip] Title-only callout

[!faq]- Are callouts foldable?
Yes! In a foldable callout, the contents are hidden when the callout is collapsed

[!faq]+ Are callouts foldable?
Yes! In a foldable callout, the contents are hidden when the callout is collapsed

[!question] Can callouts be nested?

[!todo] Yes!, they can.

[!example] You can even use multiple layers of nesting.

@bep bep modified the milestones: v0.134.0, Unscheduled Aug 31, 2024
@bep bep changed the title Extend blockquote alerts to support Obsidian AlertText Extend blockquote alerts to support Obsidian AlertTitle Sep 1, 2024
bep added a commit to bep/hugo that referenced this issue Sep 1, 2024
* Make the alert type parsing more flexible to support more types
* Add `AlertTitle` and `AlertSign` (for folding)

Note that GitHub will not render callouts with alert title/sign.

See https://help.obsidian.md/Editing+and+formatting/Callouts

Closes gohugoio#12805
Closes gohugoio#12801
bep added a commit to bep/hugo that referenced this issue Sep 1, 2024
* Make the alert type parsing more flexible to support more types
* Add `AlertTitle` and `AlertSign` (for folding)

Note that GitHub will not render callouts with alert title/sign.

See https://help.obsidian.md/Editing+and+formatting/Callouts

Closes gohugoio#12805
Closes gohugoio#12801
bep added a commit to bep/hugo that referenced this issue Sep 1, 2024
* Make the alert type parsing more flexible to support more types
* Add `AlertTitle` and `AlertSign` (for folding)

Note that GitHub will not render callouts with alert title/sign.

See https://help.obsidian.md/Editing+and+formatting/Callouts

Closes gohugoio#12805
Closes gohugoio#12801
@bep bep closed this as completed in #12815 Sep 1, 2024
@bep bep closed this as completed in e651d29 Sep 1, 2024
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants