Note that your example bibliography astually has a yaml comment instead of the text #smallcaps[smallcaps]
in it. Your bibliography needs to at least read
wold:
type: article
author:
- Doe, J.
title: "The Title with #smallcaps[smallcaps]"
Now the question is: can we make Typst interpret any Typst markup in the title? The answer is: basically yes
#let bib = ```yaml
wold:
type: article
author:
- Doe, J.
title: "The Title with #smallcaps[smallcaps]"
```.text
#show bibliography: it => {
show text: it => {
// we must not attempt to evaluate text that is not valid markup
// thankfully most text _is_, but unbalanced closing brackets don't work
if it.text == "]" { return it }
// evaluate any formatting
let result = eval(it.text, mode: "markup")
// if nothing was formatted, return the original content
// to avoid infinite recursion
if result.func() == text { return it }
// emit the formatted content
result
}
it
}
#bibliography(bytes(bib), full: true)
The show rule here uses eval()
to format any text in the bibliography. This may result in false positives! It’s now necessary for you to ensure any bibliography content is valid Typst markup!
Since formatted text is also text, the show rule here needs to guard against recursion. I’m doing this by checking whether the formatting result is anything other than a simple text.
Hope this helps!