From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.text.pandoc/25156 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Umut Acar Newsgroups: gmane.text.pandoc Subject: Re: code block translation from latex to html Date: Fri, 8 May 2020 10:09:43 -0400 Message-ID: References: <49108dd7-3ee5-41b5-9b8c-92c558ff46b5@googlegroups.com> Reply-To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000a07d6e05a5238ecb" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="73746"; mail-complaints-to="usenet@ciao.gmane.io" Cc: pandoc-discuss To: John MacFarlane Original-X-From: pandoc-discuss+bncBDAL3NWYRQARBS6Q2X2QKGQE5MW4NHI-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Fri May 08 16:10:24 2020 Return-path: Envelope-to: gtp-pandoc-discuss@m.gmane-mx.org Original-Received: from mail-pl1-f184.google.com ([209.85.214.184]) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jX3hn-000J3p-OC for gtp-pandoc-discuss@m.gmane-mx.org; Fri, 08 May 2020 16:10:23 +0200 Original-Received: by mail-pl1-f184.google.com with SMTP id m2sf1600404plt.17 for ; Fri, 08 May 2020 07:10:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1588947022; cv=pass; d=google.com; s=arc-20160816; b=tTYvwwQRKkIuu//kuHf3rGPu1cwBmf0u9oV6dP7dJK9Dudg4D4vAfp6jn6FkyYiCgu k+Ndd5nuZE0anRwjj3gEoz04DPM2TwcGAmwhnhHvGrPPZCaRGqUplXuv9aa1mFBWwt0O GEuk83+ZZqHNd8H43CNnHRAp/mJibTIDJTjqT9rtDzTTbcFk21ONobfH0NWveCg5f+DO lQyqF9bvIU5Qfu4+Jl9Uq1fakzpRLyyMDUlSjzlN6t7tJLW6QA/PODxD5do0CdqZ+lk+ kzOj0NWlViaDraZbyT9f5WuarGxKYG7PaJFrKaMrWgF2dk21vTEAk22U/APK7NCC4sO7 brkg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:sender:dkim-signature :dkim-signature; bh=c+xdGk9d7wnCnWMAvokz92DLrOkBxuXCrs9VlppB9XY=; b=meXe8c9bLPXgBQw353P2o/yzJgb0Kwvz93zAQvskdClqApjor4a7QfcfZKLInR/XfR mY1WcUKY0fRBX7cDy2MHnIASK7WxJDxFqq7LueMNWfY/e1x9f2gAs3E0InlP9p2S+h+7 MUoK53mc4VykLGX+SNZcqpcQITNhzLXY8e3i18/ACS/h5tKFuShM61lva45VFlAFIyeP KaZaGQdihrtlpS0y6hWpopylj3r+aoI1vupht0XYvewCyjQFDkZ+lQMOph+/BtXLdjOn qsDcznIOmGASYyb7lbwYyVrhnsK5yXK1tNsxyOhUFGyOD6GD+dgcZrZB78IpSfymaLRD 2RIA== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="gcB/QGq+"; spf=pass (google.com: domain of umutacar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::d2d as permitted sender) smtp.mailfrom=umutacar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:references:in-reply-to:from:date:message-id :subject:to:cc:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:list-post:list-help :list-archive:list-subscribe:list-unsubscribe; bh=c+xdGk9d7wnCnWMAvokz92DLrOkBxuXCrs9VlppB9XY=; b=MQUYwsKdH1TfVngHAK2UlGr953nxueyjtWgVS5mr/tcZB1NN+hMEnX33QSlweaVzaS f6kSZOIdIsMZi6D+2sqevwoaYLgo6H00jPfrgQf8dfHg1AKCszKtMcjhe/C95+tn/sgM bbpNXdRxSxIEGb2nx+oovSd/XpOs5kDcS/efYVR1xpokBW8EW/MjXU0jurOh0a8tEOtU 3106xewWvDnvsL01HC+8dkhauRdLAMixQVfcEfw+nO+Hdb60JH9I5zR9tgSChb50bXLY relmRQTTLx0D9kcRxDbGeGTEy0cmrdBepJWWICM6Yxpz0E3B63wi0HGnMwkl442CYvJ8 M+gQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:x-original-sender:x-original-authentication-results:reply-to :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=c+xdGk9d7wnCnWMAvokz92DLrOkBxuXCrs9VlppB9XY=; b=sS/nZzJJZtha9+DvYCld8vP9KhWFjx7iBe0ZZzR6oE9rp+34hOOJ1DTAmfgf/B/uxS b6+bUMz7ulNP/75NlksIxV+8SXgc2WsD03WAV2UuNoW79p5rzxXuO4Rew+Ulrblgdwqt 8ObM2jijpdKDgn027682WMY51hV+xDSYTCUrb+xL6HOZ6tQSZwxTYOc6mRHmz3N4MgV1 1qAKz0dqug2/PeO2wy70+PbzaMieiG5coVSaFoJHGmgkO2AxnrX+Xam0eKtTV65vc47O 7YHfHEMHBT+G3BhCCDmmhpM7sTk4a0y6Iy8JbPS5jYKR1rJedf6owINTJRUJjk8Sk08H qzFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:references:in-reply-to:from :date:message-id:subject:to:cc:x-original-sender :x-original-authentication-results:reply-to:precedence:mailing-list :list-id:x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=c+xdGk9d7wnCnWMAvokz92DLrOkBxuXCrs9VlppB9XY=; b=KGZSALfZ37jCzBF8GY9xCxO3DZx9Sn2kH54+u6M0QhQY3jSNNAbwwgpP+dC4X0Ev7e nMkf4IC0cMMXwfC7HMvrj0qtmsDEnIrvc6L7Sjd/ahcJMhndZMMULiBqmR1Wz/vnIHYh hY/4V5Lsc4jG9FALvJaTSSiRLPgDbcZDqn8K5gUqndOzBjwhXvaZ6l11zQK6V3JhYdCZ J0k47v/32ARsspOjRyGbNMI7HDsGZxgS6qttIo/rnehigdmMS5yxm+y9s1tBUJDGlU6B X+z/QGeSlSV07d8OGfpLDU9L0HU+T28xRkCcQMgo3jKWfI3VOgtIyCOgAIhWp+k7kztW zLIQ== Original-Sender: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org X-Gm-Message-State: AGi0PuZ2RAR8XrvHnOD7Sw2gvDqmwQ6SNWtpkXM7nXYUK1fk898R/fP1 L1xfWKBPNjLGXE8xgGzFxEY= X-Google-Smtp-Source: APiQypIRyivEg+5Y5rzgIgUVs8eh3qYr3pk0O+xixTuuAp3LCe34Rgs32XTrzTDj5a5H3q9nQasCXA== X-Received: by 2002:a17:90a:9b82:: with SMTP id g2mr6603542pjp.72.1588947022412; Fri, 08 May 2020 07:10:22 -0700 (PDT) X-BeenThere: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Original-Received: by 2002:a17:90a:370c:: with SMTP id u12ls12073405pjb.2.gmail; Fri, 08 May 2020 07:10:19 -0700 (PDT) X-Received: by 2002:a17:90a:ee84:: with SMTP id i4mr6449518pjz.71.1588947019598; Fri, 08 May 2020 07:10:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588947019; cv=none; d=google.com; s=arc-20160816; b=JADnzX7+xPFfVB0CzNPKf9IP/SMaruYPZPUWMrdo9b7gE73mMTNT/bxDTxLHDz0+Dj /yfA0CU/OFr7ncr7jPk78aDwutwN/q3IUR1fhzg/uljntrVsmimljbDrrE9GWfnIMxKY x2u6TeKJIjYZYwYc1bZeDGbY1v9p4o0ivNVKcsZ4mgHgrAOTDwHW4JVmaAy3CQo2mTdh 84C3Smh9GjgbEYAPXP2KJZLeiANuL67hRLTFzXToW2L1iGZHRsBaHOHjNIp2nR/r/DVz z0zth9zIs7YVLqaaDWWT1cLk1fF9vGRwf5/4jHY90Er82FxTpW9lJvLDhov3To68UwJM 6/ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=Fj55Z26GiIiNqYJFEy0kjH34yEwu7+0dF5DrHER23Hc=; b=wgn+tBsiz5sEa8miXFtDsMnuXZiIJ8TqC6aZAhuLNffbsHQx/M/Y8lTwHWWfGKiUaC tRh9YjhpWm6AkpZfUvRpcCMPdLCO8oDs2LmHq56GbuIldt7/SIjTMDpSzffBjclfrIyL uBwlI6TlUhd3PUmNUNb2npVzq/FtctcnuZJt3U6BcyEEY5Ze25b5Ripnpkx+RvI3NGGl O6AtY+iwnliirqBJAE9kWOob/eNH/BO64aAnZtp7U2PiSTdhjDZvfyp7ovj9Oz5i7Kiv s8GnXcamWtilQD0PPLTow/syLbJjSmTdiPSCGCi7/BgX/cViIv0Qct/aZvQBLJ0DHJQa ll3Q== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="gcB/QGq+"; spf=pass (google.com: domain of umutacar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::d2d as permitted sender) smtp.mailfrom=umutacar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Original-Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com. [2607:f8b0:4864:20::d2d]) by gmr-mx.google.com with ESMTPS id w15si165487pff.1.2020.05.08.07.10.19 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 May 2020 07:10:19 -0700 (PDT) Received-SPF: pass (google.com: domain of umutacar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::d2d as permitted sender) client-ip=2607:f8b0:4864:20::d2d; Original-Received: by mail-io1-xd2d.google.com with SMTP id w4so1902876ioc.6 for ; Fri, 08 May 2020 07:10:19 -0700 (PDT) X-Received: by 2002:a6b:6618:: with SMTP id a24mr2762919ioc.85.1588947018871; Fri, 08 May 2020 07:10:18 -0700 (PDT) In-Reply-To: X-Original-Sender: umutacar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="gcB/QGq+"; spf=pass (google.com: domain of umutacar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org designates 2607:f8b0:4864:20::d2d as permitted sender) smtp.mailfrom=umutacar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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:25156 Archived-At: --000000000000a07d6e05a5238ecb Content-Type: text/plain; charset="UTF-8" Hi John, thank you for the response! Soon after making the post, I realized that there was more to this than I realized and deleted the question but I imagine that it had already landed in your mailbox. The problem seems to be that my code, which processes pandoc output a bit, turns empty anchors for line numbers into self closing anchor tags. These self closing tags seem to break the browser, which include the whole code line as the anchor text. I will look into more closely why and post an update. I am a bit puzzled at the moment. On Fri, May 8, 2020, 12:45 AM John MacFarlane wrote: > > You need to provide us with more to go on. > By itself this input wouldn't produce highlighted code at all > (no language is specified). > > Try this markdown sample: > > ~~~~~~ > One: > > ``` {.haskell .numberLines} > let x = tail y in > x <> y > ``` > > Two: > > ``` {.haskell .numberLines} > x >>= y >>= z > ``` > ~~~~~~ > > This works fine. Line numbers are generated. The line numbers are > links to the line (very useful!). The two snippets generate separate > ids with links to separat elines. > > Without the 'numberLines' class you don't get the line numbers, > and the lines are NOT links to themselves. > > When converting from LaTeX/listings, you'll need to add the > numbers=left option to get numbering. > > In your output > > 2 ( class="dt">int) > > the line is not a link to itself (tested on browser just to make > sure); there is an element but its content is empty since > you don't have a line number. > > > > > > > Umut Acar writes: > > > At some point after pandoc version 2.7.2, pandoc started translating > code > > blocks to html from LaTeX sources somewhat differently. > > > > For example, the code block > > > > ``` > > \begin{lstlisting} > > ... > > 2 (int) > > \end{lstlisting} > > ``` > > used to produce the following html > > ``` > > 2 > ( > class="dt">int) > > ``` > > It now produces the following > > ``` > > 2 ( > class="dt">int) > > ``` > > > > On a browser, the latter renders the code "int" as a html link to > itself; > > the code line is rendered as a link (to itself). > > > > Also, because the code anchor id's such as `cb2-4` are not unique > (multiple > > code blocks generate the same id's), clicking on a code line sends the > > browser to the first instance of that id, usually somewhere up the page. > > > > The new translation is also dropping the code line numbers. > > > > Any thoughts about what might be going on and suggestions about how this > > could be fixed? I would be happy with the prior behavior code lines > were > > not assigned anchor tags and were numbered serially. > > > > > > > > > > -- > > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/49108dd7-3ee5-41b5-9b8c-92c558ff46b5%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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAJ2-sn2Mh79PY4JK3kvcrLMwHgQqmJ6%2BN%2BbDAP%2BW7K_aSaj3oQ%40mail.gmail.com. --000000000000a07d6e05a5238ecb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi John, thank you for the response!=C2=A0=C2=A0Soon after making the p= ost, I realized that there was more to this than I realized=C2=A0and deleted the question but I imagine that it= had=C2=A0al= ready landed in your mailbox.

The problem seems to be that my code,=C2=A0 which processes=C2=A0pandoc output a bit, turns empty anchor= s for line numbers into self closing anchor tags.=C2=A0 These self closing tags=C2=A0seem to break=C2=A0the bro= wser, which include= =C2=A0the whole code line as the anchor=C2=A0text.=C2=A0 I will look into more closely = why and post an update.=C2=A0 I am a bit puzzled at the moment.


On Fri, May 8, 2020, 12:45 AM John MacFa= rlane <jgm@berkele= y.edu> wrote:

You need to provide us with more to go on.
By itself this input wouldn't produce highlighted code at all
(no language is specified).

Try this markdown sample:

~~~~~~
One:

``` {.haskell .numberLines}
let x =3D tail y in
=C2=A0 =C2=A0 x <> y
```

Two:

``` {.haskell .numberLines}
x >>=3D y >>=3D z
```
~~~~~~

This works fine. Line numbers are generated. The line numbers are
links to the line (very useful!).=C2=A0 The two snippets generate separate<= br> ids with links to separat elines.

Without the 'numberLines' class you don't get the line numbers,=
and the lines are NOT links to themselves.

When converting from LaTeX/listings, you'll need to add the
numbers=3Dleft option to get numbering.

In your output

<span id=3D"cb2-4"><a href=3D"#cb2-4"></= a><span class=3D"dv">2</span> (<span
class=3D"dt">int</span>)=C2=A0 </span>

the line is not a link to itself (tested on browser just to make
sure); there is an <a> element but its content is empty since
you don't have a line number.






Umut Acar <umutacar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:

> At some point after pandoc version 2.7.2, pandoc started translating c= ode
> blocks to html from LaTeX sources somewhat differently.=C2=A0
>
> For example,=C2=A0 the code block
>
> ```
> \begin{lstlisting}
> ...
> 2 (int)
> \end{lstlisting}
> ```
> used to produce the following html
> ```
> <a class=3D"sourceLine" id=3D"cb2-4" title=3D&q= uot;4"><span class=3D"dv">2</span> (<span =
> class=3D"dt">int</span>)=C2=A0
> ```
> It now produces the following
> ```
> <span id=3D"cb2-4"><a href=3D"#cb2-4">= </a><span class=3D"dv">2</span> (<span
> class=3D"dt">int</span>)=C2=A0 </span>
> ```
>
> On a browser,=C2=A0 the latter renders the code "int" as a h= tml link to itself;
> the code line is rendered as a link (to itself).
>
> Also, because the code anchor id's such as `cb2-4` are not unique = (multiple
> code blocks generate the same id's), clicking on a code line sends= the
> browser to the first instance of that id, usually somewhere up the pag= e.
>
> The new translation is also dropping the code line numbers.
>
> Any thoughts about what might be going on and suggestions about how th= is
> could be fixed?=C2=A0 =C2=A0I would be happy with the prior behavior c= ode lines were
> not assigned anchor tags and were numbered serially.=C2=A0
>
>
>
>
> --
> You received this message because you are subscribed to the Google Gro= ups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send= an email to pandoc-discuss+unsubscribe@googlegr= oups.com.
> To view this discussion on the web visit https://groups= .google.com/d/msgid/pandoc-discuss/49108dd7-3ee5-41b5-9b8c-92c558ff46b5%40g= ooglegroups.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://g= roups.google.com/d/msgid/pandoc-discuss/CAJ2-sn2Mh79PY4JK3kvcrLMwHgQqmJ6%2B= N%2BbDAP%2BW7K_aSaj3oQ%40mail.gmail.com.
--000000000000a07d6e05a5238ecb--