From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/30809 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Emiliano Newsgroups: gmane.text.pandoc Subject: Re: Way to have markdown ==highlighting== show up as highlighting in .docx or .odt files? Date: Thu, 23 Jun 2022 04:14:44 -0700 (PDT) Message-ID: <3316a007-a142-4d3d-a2f8-40befafb4249n@googlegroups.com> References: <9995ee8a-295e-1836-5645-9bb5ff76445d@reagle.org> <9d89679a-94dc-2459-822f-93dbe4cbca57@reagle.org> <2cf7ddb7-c135-441c-8758-d780938bb5ffn@googlegroups.com> <489be9a1-e45a-4bee-ab8d-ce83ca7ed292n@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_504_597003906.1655982884913" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13155"; mail-complaints-to="usenet@ciao.gmane.io" To: pandoc-discuss Original-X-From: pandoc-discuss+bncBDM7PRPHYAPRBJUW2GKQMGQEFMIFMEQ-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Thu Jun 23 13:14:50 2022 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-yb1-f186.google.com ([209.85.219.186]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o4KnR-0003Hy-Iu for gtp-pandoc-discuss@m.gmane-mx.org; Thu, 23 Jun 2022 13:14:49 +0200 Original-Received: by mail-yb1-f186.google.com with SMTP id d6-20020a256806000000b00668a3d90e95sf17015240ybc.2 for ; Thu, 23 Jun 2022 04:14:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20210112; h=sender:date:from:to:message-id:in-reply-to:references:subject :mime-version:x-original-sender:reply-to:precedence:mailing-list :list-id:list-post:list-help:list-archive:list-subscribe :list-unsubscribe; bh=1GtPYAxLpHcuXrgW15Mz6o055lqLSdjiWxc9JE+fIf0=; b=EMPad1aV0GzlsFO2P3LRQ9/85ovYk5dQ5J++WLimWWl4FmADgWcnwGTA7F3pQOVo0B QYKpyl3HD/Wg+klvbASEAIInfm8R6a96TMMN4pRI4UgHjGpxVjbczzoubgmOGvmbVGDd QmKlytAuVDl7lYu/vBU58UrJK9rWidpcKHgLCxRZqaJSDQACOPbGFC+Dkdi75atMCxEL rjiXBXAFU6vKW1EfsBJK4EPTnidg41Xx92Ia52ac+6PAvIap6YutqXoVQeU6hnNFHnaW 11MW3+fC2A+u/b/JIF/+kvauozFCO46oA3wYDwKOprzloeJ2yNOSR5cqeBF0geImhGEj uPCg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:message-id:in-reply-to:references:subject:mime-version :x-original-sender:reply-to:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-subscribe:list-unsubscribe; bh=1GtPYAxLpHcuXrgW15Mz6o055lqLSdjiWxc9JE+fIf0=; b=KCBbhdQcTTlxRYJ1Eh3P5tbL55G5qdcIGan7I51cvCWeqUrsRWyejkhvjzaMvCM8XQ be4iDMpx8ybmajO4H/ME8zjs6Wu/D8QMSm9fjxXFr2Mmcu/MwB7TAIc23lt+Atdce0b2 xiiV3h73ZHkXrbAZ6tZdpReLXs/rFRtKkFU6+IwHUKFOxObMGNWjKWKT9oOsRfIzHkUD GqskjEJWbR3RnXhMNbBywp7Qqpuyau1IXktgX82T/LN42PBcH9VejwFMxxwMTyuBCr+C 2miEIpBnkQRw1x3HuqFWifP4AuWPv9Yf8U4IhDDlBP4Xa3R2TM9+GJccaM9YPRkSuCAE n2/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=sender:x-gm-message-state:date:from:to:message-id:in-reply-to :references:subject:mime-version:x-original-sender:reply-to :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=1GtPYAxLpHcuXrgW15Mz6o055lqLSdjiWxc9JE+fIf0=; b=CX9MhYEIIiFcrPADNBVXopk2/tUDNzjEiGaDgGCeuwYKP3k8DUAoEi5GQu7bgPermk 1argKRNiuduXaXOB6hAzdzWMxRiDoteCQzc5svoC45dDrojB2SBDndnddo4EoDpBpnBO vTT8HPiO9Tlc3NEr0UMeN6xdJhZth0aLV4ESj+kkHYM61RN2WFLdLoyb6J85UniFGak9 F9iDsQWewVQNCgKMd+EsRc7Ooj7C2YWw/uM4cFt1dz1OuruIqbyEAQceuef94An7sKXb KdmR2HbzjwT8KcjlhRkg9yWfe0XoV2PcQ67g4Z9J0gSe2u86daMgAM3kuAP/SoBB6wTp k1Yw== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AJIora/w7YYUlbpXCBWSoaJ5Ud/FS3Wn+fL+B2KP3O7OCtpdDknvtlcT YebeBk6G4GK+NRn6/Y0KKVs= X-Google-Smtp-Source: AGRyM1stVQYuscBp1ZW0G3Er2lJb8AtcWO/ZgjkO2gJgMcftN91TYl3WsBqKfjAZewo4l1oZbopFfQ== X-Received: by 2002:a81:2f84:0:b0:314:2bfd:bf1f with SMTP id v126-20020a812f84000000b003142bfdbf1fmr9721804ywv.320.1655982888490; Thu, 23 Jun 2022 04:14:48 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a25:dd07:0:b0:669:af8e:f753 with SMTP id u7-20020a25dd07000000b00669af8ef753ls776547ybg.2.gmail; Thu, 23 Jun 2022 04:14:45 -0700 (PDT) X-Received: by 2002:a25:ac05:0:b0:668:ac6f:8ec5 with SMTP id w5-20020a25ac05000000b00668ac6f8ec5mr8778191ybi.439.1655982885480; Thu, 23 Jun 2022 04:14:45 -0700 (PDT) In-Reply-To: X-Original-Sender: gattulli.emiliano-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Precedence: list Mailing-list: list pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org; contact pandoc-discuss+owners-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org List-ID: X-Google-Group-Id: 1007024079513 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Xref: news.gmane.io gmane.text.pandoc:30809 Archived-At: ------=_Part_504_597003906.1655982884913 Content-Type: multipart/alternative; boundary="----=_Part_505_1082323689.1655982884913" ------=_Part_505_1082323689.1655982884913 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable BPJ, is it possible to create a lua filter that does the same thing but it= =20 converts Obsidian syntax '=3D=3D =3D=3D' into a highlighted text? I have to= ns of=20 notes written in Obsidian syntax and it would be an enormous task to modify= =20 all of them with the 'new' syntax. By the way, your lua filter works=20 perfectly! Il giorno mercoled=C3=AC 22 giugno 2022 alle 19:45:07 UTC+2 BPJ ha scritto: > According to the principle that it's better to find out what you can do= =20 > with the tools you have you can use a span with a class, like `[text]{.hl= }`=20 > and use a simple filter to convert that to Obsidian's syntax when=20 > processing with Obsidian, by choosing `markdown` as output format, or=20 > insert the necessary LaTeX markup when producing PDF (or arrange for the= =20 > necessary CSS to be loaded if producing PDF via HTML.) > > ``````lua > local eq_hl =3D pandoc.RawInline('markdown', '=3D=3D') > > local highlight =3D { > markdown =3D { start =3D eq_hl, stop =3D eq_hl }, > latex =3D { > start =3D pandoc.RawInline('latex', '\\colorbox[named]{yellow}{'), > stop =3D pandoc.RawInline('latex', '}'), > }, > } > > local hl =3D highlight[FORMAT] > > function Span (s) > if s.classes:includes('hl') then > if hl then > rv =3D 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=20 > package. You may need a modifier template. > > I can imagine you lose some in-editor preview, but you get reasonable=20 > output. > > HTH, > > /bpj > > Den ons 22 juni 2022 16:11Emiliano skrev: > >> Well, if you export in PDF through Obsidian the highlighted text is=20 >> rendered correctly but not if you use Pandoc. I do not export in PDF=20 >> through Obsidian because then I would be bound to the style of the activ= e=20 >> theme, namely, I would see the PDF file with a black background (I use t= he=20 >> Dark Mode), font size, spacing, margins, etc. of Obsidian's active theme= . >> >> Il giorno marted=C3=AC 21 giugno 2022 alle 18:44:42 UTC+2=20 >> paulschi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org ha scritto: >> >>> Good question! Thanks for reminding me of this. But exporting to PDF in= =20 >>> 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=20 >>>> syntax ('=3D=3D =3D=3D') in Obsidian and it would be great if I could = render my=20 >>>> highlighted text in PDF (also in DOCX and ODT). >>>> >>>> Il giorno domenica 2 gennaio 2022 alle 17:52:44 UTC+1 Alx Nbl ha=20 >>>> scritto: >>>> >>>>> My use case is different from paulschi, in my case i am trying to=20 >>>>> convert docx into markdown and generating '=3D=3D =3D=3D' syntax when= there is=20 >>>>> higlighted text in the docx file. >>>>> >>>>> On Sunday, January 2, 2022 at 3:09:42 PM UTC+1 Alx Nbl wrote: >>>>> >>>>>> Hi all. The '=3D=3D =3D=3D' syntax is also used by Joplin app. I wou= ld also=20 >>>>>> be very interested by such a feature. >>>>>> >>>>>> On Thursday, December 9, 2021 at 6:29:51 PM UTC+1 John MacFarlane=20 >>>>>> wrote: >>>>>> >>>>>>> >>>>>>> On CriticMarkup, see=20 >>>>>>> >>>>>>> https://github.com/jgm/pandoc/issues/2873=20 >>>>>>> https://github.com/jgm/pandoc/issues/5430=20 >>>>>>> >>>>>>> >>>>>>> Joseph Reagle writes:=20 >>>>>>> >>>>>>> > BTW: If CommonMark or pandoc were to support highlight, I would= =20 >>>>>>> then wonder why not support all of CriticMarkup, which supports hig= hlight=20 >>>>>>> as `{=3D=3D =3D=3D}` or `{>> <<}`. (It's a shame that we have two d= ifferent=20 >>>>>>> syntaxes emerging for highlight.)=20 >>>>>>> >=20 >>>>>>> > On 21-12-09 11:10, John MacFarlane wrote:=20 >>>>>>> >>=20 >>>>>>> >> If this is a syntax that is becoming common, we could consider= =20 >>>>>>> >> adding a markdown extension for it. You could open an issue on= =20 >>>>>>> >> our issue tracker.=20 >>>>>>> >>=20 >>>>>>> >> Joseph Reagle writes:=20 >>>>>>> >>=20 >>>>>>> >>> This is the first time I've encountered [this syntax][1] and it= =20 >>>>>>> is not natively supported by pandoc. Or am I wrong and you are sayi= ng=20 >>>>>>> pandoc handles it when using the latex/PDF writer? (Or, are you say= ing=20 >>>>>>> Obsidian can export to PDF, but not Word?)=20 >>>>>>> >>>=20 >>>>>>> >>> I see there's been some discussion on the [CommonMark forum][2]= ,=20 >>>>>>> but it doesn't look like you'd find an immediate solution.=20 >>>>>>> >>>=20 >>>>>>> >>> Using a filter or hacking something that converts `=3D=3Dfoo=3D= =3D` to=20 >>>>>>> [foo]{.highlight} that is properly rendered in Word might be option= s.=20 >>>>>>> >>>=20 >>>>>>> >>> [1]: https://www.markdownguide.org/extended-syntax/#highlight= =20 >>>>>>> >>> [2]:=20 >>>>>>> https://talk.commonmark.org/t/highlighting-text-with-the-mark-eleme= nt/840=20 >>>>>>> >>>=20 >>>>>>> >>> On 21-12-09 08:29, Paul wrote:=20 >>>>>>> >>>> I use a lot of highlighting in my markdown editor Obsidian, bu= t=20 >>>>>>> I was wondering if there's a way to have that highlighting show up = in the=20 >>>>>>> Word or Libreoffice Writer files?=20 >>>>>>> >>>>=20 >>>>>>> >>>> Bold and italics work fine, as far as I can tell, and when=20 >>>>>>> converting to a pdf the highlighting transfers great. I gather, how= ever,=20 >>>>>>> that the =3D=3Dhighlighting=3D=3D is not standard in all markdown s= o is that the=20 >>>>>>> issue?=20 >>>>>>> >>>=20 >>>>>>> >>> --=20 >>>>>>> >>> You received this message because you are subscribed to the=20 >>>>>>> Google Groups "pandoc-discuss" group.=20 >>>>>>> >>> To unsubscribe from this group and stop receiving emails from= =20 >>>>>>> it, send an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org=20 >>>>>>> >>> To view this discussion on the web visit=20 >>>>>>> https://groups.google.com/d/msgid/pandoc-discuss/9995ee8a-295e-1836= -5645-9bb5ff76445d%40reagle.org.=20 >>>>>>> >>>>>>> >>=20 >>>>>>> >=20 >>>>>>> > --=20 >>>>>>> > You received this message because you are subscribed to the Googl= e=20 >>>>>>> Groups "pandoc-discuss" group.=20 >>>>>>> > To unsubscribe from this group and stop receiving emails from it,= =20 >>>>>>> send an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org=20 >>>>>>> > To view this discussion on the web visit=20 >>>>>>> https://groups.google.com/d/msgid/pandoc-discuss/9d89679a-94dc-2459= -822f-93dbe4cbca57%40reagle.org.=20 >>>>>>> >>>>>>> >>>>>> --=20 >> You received this message because you are subscribed to the Google Group= s=20 >> "pandoc-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send a= n=20 >> email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > To view this discussion on the web visit=20 >> https://groups.google.com/d/msgid/pandoc-discuss/ba18ff15-897d-4a7f-bbd4= -3735da206f1dn%40googlegroups.com=20 >> >> . >> > --=20 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 e= mail to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/3316a007-a142-4d3d-a2f8-40befafb4249n%40googlegroups.com. ------=_Part_505_1082323689.1655982884913 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable BPJ, is it possible to create a lua filter that does the same thing but it = converts Obsidian syntax '=3D=3D =3D=3D' into a highlighted text? I have to= ns of notes written in Obsidian syntax and it would be an enormous task to = modify all of them with the 'new' syntax. By the way, your lua filter works= perfectly!

Il giorno mercoled=C3=AC 22 giugno 2022 alle 19:45:07 UTC+2 BPJ h= a scritto:
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, l= ike `[text]{.hl}` and use a simple filter to convert that to Obsidian's= syntax when processing with Obsidian, by choosing `markdown` as output for= mat, or insert the necessary LaTeX markup when producing PDF (or arrange fo= r the necessary CSS to be loaded if producing PDF via HTML.)

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

local highlight =3D {
=C2=A0 markdown =3D { start =3D eq_hl, stop =3D eq_hl },
=C2=A0 latex =3D {
=C2=A0 =C2=A0 star= t =3D pandoc.RawInline('latex', '\\colorbox[named]{yellow}{'= ;),
=C2=A0 =C2=A0 stop =3D pandoc.RawInline('lat= ex', '}'),
=C2=A0 },
}

local hl =3D highl= ight[FORMAT]

function Sp= an (s)
=C2=A0 if s.classes:includes('hl') th= en
=C2=A0 =C2=A0 if hl then
= =C2=A0 =C2=A0 =C2=A0 rv =3D s.content
=C2=A0 =C2=A0 = =C2=A0 rv:insert(1, hl.start)
=C2=A0 =C2=A0 =C2=A0 r= v:insert(hl.stop)
=C2=A0 =C2=A0 =C2=A0 return rv
=C2=A0 =C2=A0 end
=C2=A0 end
=C2=A0 return nil
end
``````

I= 9;m not sure that the default LaTeX template always loads the xcolor packag= e. You may need a modifier template.

I can imagine you lose some in-editor preview, but you get rea= sonable output.

HTH,

/bpj

Den ons 22 juni 2022 16:11Emiliano <gattulli...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev:
=
Well, if you expo= rt in PDF through Obsidian the highlighted text is rendered correctly but n= ot 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=C3=AC 21 giug= no 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?=

O= n Tuesday, June 21, 2022 at 3:21:03 p.m. UTC+2 Emiliano wrote:
Any news about this feature for Pa= ndoc? I use a lot the highlight syntax ('=3D=3D =3D=3D') in Obsidia= n 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 N= bl ha scritto:
My use case i= s different from=C2=A0paulschi, in my case i am trying to con= vert docx into markdown and generating '=3D=3D =3D=3D' 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 '=3D=3D =3D=3D' syntax is also used by Jop= lin app. I would also be very interested by such a feature.

On Thursday, Dece= mber 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 th= en wonder why not support all of CriticMarkup, which supports highlight as = `{=3D=3D =3D=3D}` or `{>> <<}`. (It's a shame that we have = two different syntaxes emerging for highlight.)
>
> On 21-12-09 11:10, John MacFarlane wrote:
>>=20
>> If this is a syntax that is becoming common, we could consider
>> adding a markdown extension for it. You could open an issue o= n
>> our issue tracker.
>>=20
>> Joseph Reagle <
josep...@reag= le.org> writes:
>>=20
>>> 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 sa= ying 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 solutio= n.
>>>
>>> Using a filter or hacking something that converts `=3D=3Df= oo=3D=3D` to [foo]{.highlight} that is properly rendered in Word might be o= ptions.
>>>
>>> [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 Obsi= dian, but I was wondering if there's a way to have that highlighting sh= ow 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, howeve= r, that the =3D=3Dhighlighting=3D=3D is not standard in all markdown so is = that the issue?
>>>
>>> --=20
>>> You received this message because you are subscribed to th= e Google Groups "pandoc-discuss" group.
>>> To unsubscribe from this group and stop receiving emails f= rom it, send an email to pandoc-discus...@go= oglegroups.com.
>>> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/9995ee8= a-295e-1836-5645-9bb5ff76445d%40reagle.org.
>>=20
>
> --=20
> 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...@googlegrou= ps.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/9d89679a-94dc-2= 459-822f-93dbe4cbca57%40reagle.org.
<= /div>

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pandoc-discus= ...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups &= quot;pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to pand= oc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/3316a007-a142-4d3d-a2f8-40befafb4249n%40googlegroups.= com.
------=_Part_505_1082323689.1655982884913-- ------=_Part_504_597003906.1655982884913--