According to the principle that it's better to find out what you can do with the tools you have you can use a span with a class, like `[text]{.hl}` and use a simple filter to convert that to Obsidian's syntax when processing with Obsidian, by choosing `markdown` as output format, or insert the necessary LaTeX markup when producing PDF (or arrange for the necessary CSS to be loaded if producing PDF via HTML.)

``````lua
local eq_hl = pandoc.RawInline('markdown', '==')

local highlight = {
  markdown = { start = eq_hl, stop = eq_hl },
  latex = {
    start = pandoc.RawInline('latex', '\\colorbox[named]{yellow}{'),
    stop = pandoc.RawInline('latex', '}'),
  },
}

local hl = highlight[FORMAT]

function Span (s)
  if s.classes:includes('hl') then
    if hl then
      rv = s.content
      rv:insert(1, hl.start)
      rv:insert(hl.stop)
      return rv
    end
  end
  return nil
end
``````

I'm not sure that the default LaTeX template always loads the xcolor package. You may need a modifier template.

I can imagine you lose some in-editor preview, but you get reasonable output.

HTH,

/bpj

Den ons 22 juni 2022 16:11Emiliano <gattulli.emiliano-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
Well, if you export in PDF through Obsidian the highlighted text is rendered correctly but not if you use Pandoc. I do not export in PDF through Obsidian because then I would be bound to the style of the active theme, namely, I would see the PDF file with a black background (I use the Dark Mode), font size, spacing, margins, etc. of Obsidian's active theme.

Il giorno martedì 21 giugno 2022 alle 18:44:42 UTC+2 paulschi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org ha scritto:
Good question! Thanks for reminding me of this. But exporting to PDF in Obsidian with highlights should work automatically, no?

On Tuesday, June 21, 2022 at 3:21:03 p.m. UTC+2 Emiliano wrote:
Any news about this feature for Pandoc? I use a lot the highlight syntax ('== ==') in Obsidian and it would be great if I could render my highlighted text in PDF (also in DOCX and ODT).

Il giorno domenica 2 gennaio 2022 alle 17:52:44 UTC+1 Alx Nbl ha scritto:
My use case is different from paulschi, in my case i am trying to convert docx into markdown and generating '== ==' syntax when there is higlighted text in the docx file.

On Sunday, January 2, 2022 at 3:09:42 PM UTC+1 Alx Nbl wrote:
Hi all. The '== ==' syntax is also used by Joplin app. I would also be very interested by such a feature.

On Thursday, December 9, 2021 at 6:29:51 PM UTC+1 John MacFarlane wrote:

On CriticMarkup, see

https://github.com/jgm/pandoc/issues/2873
https://github.com/jgm/pandoc/issues/5430


Joseph Reagle <josep...-T1oY19WcHSwdnm+yROfE0A@public.gmane.org> writes:

> BTW: If CommonMark or pandoc were to support highlight, I would then wonder why not support all of CriticMarkup, which supports highlight as `{== ==}` or `{>> <<}`. (It's a shame that we have two different syntaxes emerging for highlight.)
>
> On 21-12-09 11:10, John MacFarlane wrote:
>>
>> If this is a syntax that is becoming common, we could consider
>> adding a markdown extension for it. You could open an issue on
>> our issue tracker.
>>
>> Joseph Reagle <josep...@reagle.org> writes:
>>
>>> This is the first time I've encountered [this syntax][1] and it is not natively supported by pandoc. Or am I wrong and you are saying pandoc handles it when using the latex/PDF writer? (Or, are you saying Obsidian can export to PDF, but not Word?)
>>>
>>> I see there's been some discussion on the [CommonMark forum][2], but it doesn't look like you'd find an immediate solution.
>>>
>>> Using a filter or hacking something that converts `==foo==` to [foo]{.highlight} that is properly rendered in Word might be options.
>>>
>>> [1]: https://www.markdownguide.org/extended-syntax/#highlight
>>> [2]: https://talk.commonmark.org/t/highlighting-text-with-the-mark-element/840
>>>
>>> On 21-12-09 08:29, Paul wrote:
>>>> I use a lot of highlighting in my markdown editor Obsidian, but I was wondering if there's a way to have that highlighting show up in the Word or Libreoffice Writer files?
>>>>
>>>> Bold and italics work fine, as far as I can tell, and when converting to a pdf the highlighting transfers great. I gather, however, that the ==highlighting== is not standard in all markdown so is that the issue?
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discus...@googlegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/9995ee8a-295e-1836-5645-9bb5ff76445d%40reagle.org.
>>
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discus...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/9d89679a-94dc-2459-822f-93dbe4cbca57%40reagle.org.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh4Ykp1iOSErHA@public.gmane.orgm.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/ba18ff15-897d-4a7f-bbd4-3735da206f1dn%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CADAJKhCSGnvyAP%3DOSkNB_JRhwUgdtZ0Do8bNScw%2Bb-aQDWwzWQ%40mail.gmail.com.