rstudio / distill

Distill for R Markdown
https://rstudio.github.io/distill/
Apache License 2.0
422 stars 57 forks source link

Italics in menu #474

Closed silasprincipe closed 2 years ago

silasprincipe commented 2 years ago

Hi!

I need to italicize some text of my menu. Is it possible to add some kind of markup in the YAML file to make text as italic?

Here is how my _yaml file looks like:

  menu:
    - text: "Species models"
    - text: "_Echinometra lucunter_" <<< this one needs to be in italic.
      href: eclu.html

But this is what I'm getting for now:

image

I appreciate any help you can give! Thanks again for creating distill.

cderv commented 2 years ago

Unfortunately, we don't resolve markdown syntax in this field.

Maybe we can improve this without much trouble 🤔

I think the current workaround is to use HTML content directly using htmltools

  menu:
    - text: "Species models"
    - text: !expr htmltools::em("Echinometra lucunter") 
      href: eclu.html

or use JS + CSS to tweak the menu by modifying the DOM

in _site.yml

output:
  distill::distill_article:
    includes:
      after_body: tweak.html

Sorry for the inconvenience on that, I'll look at how improve this somehow to make more easy to use HTML directly. 🤔

silasprincipe commented 2 years ago

Thanks @cderv! I can confirm that the solution with htmltools works just fine and it's not incovenient at all! Maybe just adding this information about this possibility in the docs/distill website is more than enough.

Thanks again for the help!