From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Thu, 3 Sep 2020 13:34:21 -0700 (PDT) From: MyriaCore To: pandoc-discuss Message-Id: <3fea3a24-cdff-41a0-9c3e-ffcfadaff90en@googlegroups.com> In-Reply-To: Subject: Re: Katex ------=_Part_660_2099210794.1599165261453 Content-Type: multipart/alternative; boundary="----=_Part_661_658123240.1599165261453" ------=_Part_661_658123240.1599165261453 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Alright, so the all caps README.html is the locally-generated copy, and the= =20 lowercase readme.html one is the one that the gitlab runner generated.=20 I=E2=80=99ve been looking for a few differences, I=E2=80=99ve found a few m= ore: - the locally-generated copy doesn=E2=80=99t include the \[ \] brackets = in the=20 text of the math display span=20 - the locally-generated copy seemed to include a script that the=20 runner-generated one didn=E2=80=99t have (this is almost certainly a pro= blem): =20 =20 =20 Really not sure why this is happening here, and not locally on my laptop bu= t On Thursday, September 3, 2020 at 4:15:19 PM UTC-4 MyriaCore wrote: > Hi all! > > I=E2=80=99m really struggling setting up gitlab ci/cd=20 > to render with my=20 > notes. Everything works perfectly when I generate the html locally on my= =20 > laptop, but the gitlab runner / pages copy seems to have perpetual issues= =20 > that my laptop really doesn=E2=80=99t seem to have.=20 > > The bug I=E2=80=99m experiencing is that my math is displaying *twice* - = once in=20 > a semi-formatted way, and again beneath it, without any coherent formatti= ng=20 > whatsoever: > > When I took a peek into the head, I saw that katex=E2=80=99s scripts and = styles=20 > *did* seem to be present, but for whatever reason, they don=E2=80=99t see= m to be=20 > running. In my local copy, I have fonts and styles associated with the=20 > katex-html element that just aren=E2=80=99t even there with the katex-htm= l one=20 > served up by gitlab pages.=20 > > This is the command I=E2=80=99m using: > > pandoc --from markdown --to html5 \ > --self-contained --standalone \ > --filter pandoc-plantuml \ > --filter pandoc-mermaid \ > --lua-filter gitlab-math.lua \ > --lua-filter fix-links.lua \ > --katex=3Dhttps://cdn.jsdelivr.net/npm/katex@latest/dist/ \ > --template=3DGitHub.html5 \ > $(MARKDOWN) > > I=E2=80=99m not sure why this is happening on the runner, and not on my l= aptop.=20 > This is something that I=E2=80=99d really like to have working by the end= of the=20 > week.=20 > > It=E2=80=99s clear things aren=E2=80=99t being incorrectly parsed (for ex= ample, by some of=20 > the wonky filters=20 > I=E2= =80=99ve=20 > setup), since the raw test output appears to be doing things correctly. F= or=20 > example, this: > > {{m+n} \choose m } =3D \frac{(m+n)!}{m!n!} > > =E2=80=A6 is translated into this, when output to stdout: > >

\[{{m+n} \choose m } =3D \frac{(m+n)!}{m!= n!}\]

> > The only big difference that I=E2=80=99ve been able to spot is that on th= e pages=20 > copy, when viewed through a web browser, there seems to be a weird=20 > classless span between the math display span and the katex-display span.= =20 > Maybe this is preventing the script from recognizing the katex structures= ?=20 > Either way, I have no clue how to prevent this from happening, or why it= =E2=80=99s=20 > even happening at all. > > Any insight? Thanks so much! > --=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@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/= pandoc-discuss/3fea3a24-cdff-41a0-9c3e-ffcfadaff90en%40googlegroups.com. ------=_Part_661_658123240.1599165261453 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Alright, so the all c= aps README.html is the loca= lly-generated copy, and the lowercase readme.html one is the one that the gitlab runner generated.

I=E2=80=99ve been looking fo= r a few differences, I=E2=80=99ve found a few more:

  • the locally-generated copy doesn=E2=80=99t= include the \[ \] brackets= in the text of the math display<= /code> span
  • the locally-generated copy seemed to inclu= de a script that the runner-generated one didn=E2=80=99t have (this is almo= st certainly a problem):
    <script>document.addEventListener("DOMContentLoaded", function () {
       var mathElements =3D document.getElementsByClassName("math");
       var macros =3D [];
       for (var i =3D 0; i < mathElements.length; i++=
    ) {
        var texText =3D mathElements[i].firstChild;
        if (mathElements[i].tagName =3D=3D "SPAN") {
         katex.render(texText.data, mathElements[i], {
          displayMode: mathElements[i].classList.contains('display'),
          throwOnError: false,
          macros: macros,
          fleqn: false
         });
      }}});
    </script>
    

Really not sure why this is = happening here, and not locally on my laptop but

=E2=80=8B
On Thursday, September 3, 2020 at 4:15:19 PM UTC-4 MyriaC= ore wrote:

Hi all!

I=E2=80=99m really struggling s= etting up gitlab ci/cd to render with my notes. Everything works perf= ectly when I generate the html locally on my laptop, but the gitlab runner = / pages copy seems to have perpetual issues that my laptop really doesn=E2= =80=99t seem to have.

The bug I=E2=80=99m experiencin= g is that my math is displaying twice - once in a semi-formatted w= ay, and again beneath it, without any coherent formatting whatsoever:

3D""

When I took a peek into the hea= d, I saw that katex=E2=80=99s scripts and styles did seem to be pr= esent, but for whatever reason, they don=E2=80=99t seem to be running. In m= y local copy, I have fonts and styles associated with the = katex-html element that just aren=E2=80=99t even there with the katex-html one served up by gitlab pages.

This is the command I=E2=80=99m= using:

    pandoc --from markdow=
n --to html5 \
        --self-contained --standalone \
        --filter pandoc-plantuml \
        --filter pandoc-mermaid \
        --lua-filter gitlab-math.lua \
        --lua-filter fix-links.lua \
        --katex=3Dhttps://cdn.jsdelivr.net/npm/katex@latest/dist/ \
        --template=3DGitHub.html5  \
        $(MARKDOWN)

I=E2=80=99m not su= re why this is happening on the runner, and not on my laptop. This is somet= hing that I=E2=80=99d really like to have working by the end of the week. <= /p>

It=E2=80=99s clear things aren= =E2=80=99t being incorrectly parsed (for example, by some of the wonky filters I=E2=80=99ve setup), since = the raw test output appears to be doing things correctly. For example, this= :

{{m+n} \choose m } =3D \frac{(m+n)!}{m!n!}

=E2=80=A6 is translated into th= is, when output to stdout:

<=
p><span class=3D"math displa=
y">\[{{m+n} \choose m } =3D \frac{(m+n)!}{m!n!}\]</span<=
/span>><=
/p>

The only big difference that I= =E2=80=99ve been able to spot is that on the pages copy, when viewed throug= h a web browser, there seems to be a weird classless span between the math display span and the katex-display= span. Maybe this is preventing the script from recognizing the kate= x structures? Either way, I have no clue how to prevent this from happening= , or why it=E2=80=99s even happening at all.

Any insight? Thanks so much!

=E2=80=8B

--
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@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d= /msgid/pandoc-discuss/3fea3a24-cdff-41a0-9c3e-ffcfadaff90en%40googlegroups.= com.
------=_Part_661_658123240.1599165261453-- ------=_Part_660_2099210794.1599165261453 Content-Type: text/html; charset=UTF-8; name=README.html Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=README.html X-Attachment-Id: 3d4924a5-1d42-48e9-9fb9-21919a37141d Content-ID: <3d4924a5-1d42-48e9-9fb9-21919a37141d> Gitlab Markdown CI Setup

Gitlab Markdown CI Setup

This repository is a template / demo for my markdown CI setup. Because o= f gitlab-org/gitlab#243533, notes that use katex in gitlab markdown are kin= da buggy. Along with issues like gitlab-org/gitlab#215084, it makes sense t= o find a nice workaround for notes that make use of this.

The goal is to support common gitlab markdown features that I use in my = notes. This includes, but isn=E2=80=99t limited to: - PlantUML and Mermaid = graphs - katex math - linking to files in the repository

Below are some test snippets to ensure these features are working. This = document should be hosted here:
https://myriacore.gitlab.io/gitlab-markdown-ci/README.html


{{m+n} \choose m } =3D \frac{(m+n)!}{m!n!}<= /span>

Debugging notes:

Maybe the problem here is that for whatever reason, aria-hidden isn=E2= =80=99t rly working?

Things work when I add the hidden property instead.

The weirdest bit here, is that in the local copy that I rendered, this p= roblem isn=E2=80=99t happening at all. Like, not even a little bit.

The hidden and non-hidden classes have flipped!

Maybe the problem is that for some reason I=E2=80=99m not actually getti= ng the full katex cdn when I specify it?

Maybe there=E2=80=99s something else too. Like, maybe

34665f2e=E2=80=A6f7ddc03d

------=_Part_660_2099210794.1599165261453 Content-Type: text/html; charset=UTF-8; name=readme.html Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=readme.html X-Attachment-Id: f4bd61ba-0a02-4f19-8020-8c1aaec6ee91 Content-ID: Gitlab Markdown CI Setup

Gitlab Markdown CI Setup

This repository is a template / demo for my markdown CI setup. Because o= f gitlab-org/gitlab#243533, notes that use katex in gitlab markdown are kin= da buggy. Along with issues like gitlab-org/gitlab#215084, it makes sense t= o find a nice workaround for notes that make use of this.

The goal is to support common gitlab markdown features that I use in my = notes. This includes, but isn=E2=80=99t limited to: - PlantUML and Mermaid = graphs - katex math - linking to files in the repository

Below are some test snippets to ensure these features are working. This = document should be hosted here:
https://myriacore.gitlab.io/gitlab-markdown-ci/README.html


\[{{m+n} \choose m } =3D \frac{(m+n)!}{m!n!= }\]

Debugging notes:

Maybe the problem here is that for whatever reason, aria-hidden isn=E2= =80=99t rly working?

Things work when I add the hidden property instead.

The weirdest bit here, is that in the local copy that I rendered, this p= roblem isn=E2=80=99t happening at all. Like, not even a little bit.

The hidden and non-hidden classes have flipped!

Maybe the problem is that for some reason I=E2=80=99m not actually getti= ng the full katex cdn when I specify it?

Maybe there=E2=80=99s something else too. Like, maybe

34665f2e=E2=80=A6f7ddc03d

------=_Part_660_2099210794.1599165261453--