public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: MyriaCore <me-iMRNxolsNr8QFTY0IWPKwg@public.gmane.org>
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: Katex
Date: Thu, 3 Sep 2020 14:03:18 -0700 (PDT)	[thread overview]
Message-ID: <ba631a7b-0fc3-4964-846b-2583a707c850n@googlegroups.com> (raw)
In-Reply-To: <0e1b938d-3665-4be2-9681-c835d596aba2n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 4714 bytes --]

In the future, is there a way to support `--self-contained` (not 
`--standalone`, I misspoke) with katex at all? This still doesn't explain 
why it worked on my laptop, but not on the gitlab runner. 
On Thursday, September 3, 2020 at 4:49:07 PM UTC-4 MyriaCore wrote:

> oh my god, im gonna jump off a cliff
>
> It was literally the `--standalone` switch breaking everything. I'm so 
> dumb lol
>
> NVM, thanks guys
>
> On Thursday, September 3, 2020 at 4:34:22 PM UTC-4 MyriaCore wrote:
>
>> Alright, so the all caps README.html is the locally-generated copy, and 
>> the lowercase readme.html one is the one that the gitlab runner 
>> generated. 
>>
>> I’ve been looking for a few differences, I’ve found a few more:
>>
>>    - the locally-generated copy doesn’t include the \[ \] brackets in 
>>    the text of the math display span 
>>    - the locally-generated copy seemed to include a script that the 
>>    runner-generated one didn’t have (this is almost certainly a problem):
>>    
>>    <script>document.addEventListener("DOMContentLoaded", function () {
>>       var mathElements = document.getElementsByClassName("math");
>>       var macros = [];
>>       for (var i = 0; i < mathElements.length; i++) {
>>        var texText = mathElements[i].firstChild;
>>        if (mathElements[i].tagName == "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
>> On Thursday, September 3, 2020 at 4:15:19 PM UTC-4 MyriaCore wrote:
>>
>>> Hi all!
>>>
>>> I’m really struggling setting up gitlab ci/cd 
>>> <https://gitlab.com/myriacore/gitlab-markdown-ci> to render with my 
>>> notes. Everything works perfectly 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’t seem to have. 
>>>
>>> The bug I’m experiencing is that my math is displaying *twice* - once 
>>> in a semi-formatted way, and again beneath it, without any coherent 
>>> formatting whatsoever:
>>>
>>> When I took a peek into the head, I saw that katex’s scripts and styles 
>>> *did* seem to be present, but for whatever reason, they don’t seem to 
>>> be running. In my local copy, I have fonts and styles associated with the 
>>> katex-html element that just aren’t even there with the katex-html one 
>>> served up by gitlab pages. 
>>>
>>> This is the command I’m 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=https://cdn.jsdelivr.net/npm/katex@latest/dist/ \
>>>         --template=GitHub.html5  \
>>>         $(MARKDOWN)
>>>
>>> I’m not sure why this is happening on the runner, and not on my laptop. 
>>> This is something that I’d really like to have working by the end of the 
>>> week. 
>>>
>>> It’s clear things aren’t being incorrectly parsed (for example, by some 
>>> of the wonky filters 
>>> <https://gist.github.com/MyriaCore/75729707404cba1c0de89cc03b7a6adf> 
>>> I’ve setup), since the raw test output appears to be doing things 
>>> correctly. For example, this:
>>>
>>> {{m+n} \choose m } = \frac{(m+n)!}{m!n!}
>>>
>>> … is translated into this, when output to stdout:
>>>
>>> <p><span class="math display">\[{{m+n} \choose m } = \frac{(m+n)!}{m!n!}\]</span></p>
>>>
>>> The only big difference that I’ve been able to spot is that on the pages 
>>> copy, when viewed through 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 katex 
>>> structures? Either way, I have no clue how to prevent this from happening, 
>>> or why it’s even happening at all.
>>>
>>> Any insight? Thanks so much!
>>>
>>

-- 
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/ba631a7b-0fc3-4964-846b-2583a707c850n%40googlegroups.com.

[-- Attachment #1.2: Type: text/html, Size: 19665 bytes --]

  parent reply	other threads:[~2020-09-03 21:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-03 20:15 Katex MyriaCore
2020-09-03 20:34 ` Katex MyriaCore
     [not found]   ` <3fea3a24-cdff-41a0-9c3e-ffcfadaff90en-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-09-03 20:49     ` Katex MyriaCore
     [not found]       ` <0e1b938d-3665-4be2-9681-c835d596aba2n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-09-03 21:03         ` MyriaCore [this message]
     [not found]           ` <ba631a7b-0fc3-4964-846b-2583a707c850n-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2020-09-04  1:34             ` Katex John MacFarlane

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ba631a7b-0fc3-4964-846b-2583a707c850n@googlegroups.com \
    --to=me-imrnxolsnr8qfty0iwpkwg@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).