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

Obsidian-style callouts #465

Open
1 of 6 tasks
Tracked by #6
srid opened this issue Dec 4, 2023 · 4 comments
Open
1 of 6 tasks
Tracked by #6

Obsidian-style callouts #465

srid opened this issue Dec 4, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@srid
Copy link
Owner

srid commented Dec 4, 2023

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

Discussion: #307

Progress

Tangential

@srid srid added the enhancement New feature or request label Dec 4, 2023
@srid
Copy link
Owner Author

srid commented Dec 4, 2023

One way to implement this (especially as Pandoc AST is not flexible enough) is by having heist-extra generate the same HTML div structure as Obsidian's publish:

https://github.com/srid/heist-extra/blob/54ff970f733dd45b5509d1c4c298927b6241041b/src/Heist/Extra/Splices/Pandoc/Render.hs#L67-L69

image image

And then style it in CSS separately.

@srid srid pinned this issue Dec 4, 2023
@srid
Copy link
Owner Author

srid commented Dec 4, 2023

Actually we could just implement it as a PandocBlockRenderer (much like how embed wikilinks, queries, etc. are done)

queryResolvingSplice :: PandocBlockRenderer Model LMLRoute
queryResolvingSplice model _nr ctx noteRoute blk = do
B.CodeBlock
(_id', classes, _attrs)
(Q.parseQuery -> Just q) <-
pure blk
guard $ List.elem "query" classes
let mOtherCls = nonEmpty (List.delete "query" classes) <&> T.intercalate " " . toList
queryTpl = encodeUtf8 $ "/templates/filters/query-" <> fromMaybe "default" mOtherCls
pure $ do
tpl <- HE.lookupHtmlTemplateMust queryTpl
HE.runCustomTemplate tpl $ do
"query" ##
HI.textSplice (show q)
"result" ##
(HI.runChildrenWith . noteSpliceMap ($ ctx) model)
`foldMapM` Q.runQuery noteRoute model q

@nramirezuy
Copy link

nramirezuy commented Feb 7, 2025

It would be nice to be able to add my own callouts.

Syntax:

> [!name] callout title
> callout body

This is so nasty it might as well be AI generated, but works. If someone interested (:

@srid
Copy link
Owner Author

srid commented Feb 10, 2025

@nramirezuy What is the difference between:

> [!name] callout title
> callout body

and

> [!note] callout title
> callout body

?

How do you expect "name" to render as distinct from "note"? Instead of commenting here, can you detail your proposal over at https://github.com/srid/emanote/discussions ?

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

No branches or pull requests

2 participants