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 · 2 comments
Open
1 of 6 tasks
Tracked by #6

Obsidian-style callouts #465

srid opened this issue Dec 4, 2023 · 2 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

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

1 participant