4

I am attempting to manually change the style within an R-markdown document. In the example below I have created a reference_docx with the style named Highlight

img

--- 
title: "My Title"
output:
  bookdown::word_document2:
    fig_caption: yes
    reference_docx: my_reference.docx
link-citations: no
site: bookdown::bookdown_site
---

# Here is Header 1

I want this text to be in red using the **Highlight** style from the reference document

I have tried 

<div style="Highlight">
This text is still not red
</div>

Does anyone have any ideas? I looked into the officer package but as far as I know this will only work after the document is rendered.

Patrick
  • 915
  • 2
  • 9
  • 26

1 Answers1

1

In case anyone else finds this, here is the full answer. See the 'div' style below.

# Here is Header 1

I want this text to be in red using the **Highlight** style from the reference document

<div custom-style="Highlight">
This text should be red now.
</div>
rmflight
  • 1,871
  • 1
  • 14
  • 22