title: Using span (f)or font color in Pandoc markdown for both html and pdf?
body: <p>I would like to write in Markdown, then use either <code>&lt;font color=&quot;red&quot;&gt;red text&lt;/font&gt;</code> or <code>&lt;span style=&quot;color: red;&quot;&gt;red text&lt;/span&gt;</code> to color text, so that when the .md file is checked in say Gitlab, the font color is automatically parsed when browsing the HTML formatted version - but I also want to use the same .md file as a source for a PDF via (xe)latex.</p>
  <p>I have seen:</p>
  <ul>
  <li><a href="https://stackoverflow.com/questions/29067541/how-to-change-the-font-color">How to change the font color?</a></li>
  <li><a href="https://bookdown.org/yihui/rmarkdown-cookbook/font-color.html" rel="noreferrer">https://bookdown.org/yihui/rmarkdown-cookbook/font-color.html</a></li>
  </ul>
  <p>... and my options seem to be:</p>
  <ul>
  <li>Use <code>&lt;span&gt;</code> explicitly for HTML, and <code>\textcolor</code> explicitly for PDF via Latex, which forces me to keep two versions of the same markdown document</li>
  <li>Use Lua filter, and write like <code>violets are [blue]{color=&quot;blue&quot;}</code> - which will definitely not be parsed by whatever Markdown-to-HTML engines used by Gitlab and such</li>
  </ul>
  <p>So, I was thinking - it must be possible, that I write <code>&lt;span&gt;</code> or <code>&lt;font&gt;</code> in my file (which would/should be recognized by Gitlab and such parsers), and then have a Lua filter for pandoc, that would transform these into <code>\textcolor</code>, when using the .md file as a source to create PDF.</p>
  <p>Unfortunately, I suck at Lua, and definitely do not know the internal document model of Pandoc enough, to be able to easily guess how could I get to these kinds of tags in a Markdown file. So my question is: is there an existing filter or setting in <code>pandoc</code> already that does this - or lacking that, a Lua filter script that looks up such tags in a markdown document, that I could use a base for this kind of filtering?</p>