Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This plugin renders invalid html head if article contains raw html #502

Open
yagarea opened this issue Mar 2, 2024 · 2 comments
Open

This plugin renders invalid html head if article contains raw html #502

yagarea opened this issue Mar 2, 2024 · 2 comments

Comments

@yagarea
Copy link

yagarea commented Mar 2, 2024

This is my article:

---
layout: post
---

This post is here to test [$$\jektex$$](https://github.com/yagarea/jektex),
a lightweight jekyll plugin for LaTeX rendering $$\LaTeX$$.

## Inline example
Lorem ipsum dolor sit amet, consectetur $$e^{i\theta}=\cos(\theta)+i\sin(\theta)$$
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

## Display example
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua.

$$ \left[ \frac{-\hbar^2}{2\mu}\nabla^2 + V(\mathbf{r},t)\right] \Psi(\mathbf{r},t) $$

Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
ea commodo consequat.

This is my head definition:

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />

  <title>
    {%- if page.title -%}
      {{ page.title }}
    {%- else -%}
      {{ site.title }}
    {%- endif -%}
  </title>

  {%-seo title=false-%}
  {%-feed_meta-%}

  <link rel="shortcut icon" type="image/x-icon" href="{{ site.favicon | relative_url }}" />
  <link rel="stylesheet" href="{{ "/assets/css/main.css" | relative_url }}" />
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-MlJdn/WNKDGXveldHDdyRP1R4CTHr3FeuDNfhsLPYrq2t0UBkUdK2jyTnXPEK1NQ" crossorigin="anonymous">
</head>

And this is result:

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <title>Jektex Post</title><!-- Begin Jekyll SEO tag v2.7.1 -->
<meta name="generator" content="Jekyll v3.9.5" />
<meta property="og:title" content="Jektex Post" />
<meta name="author" content="Riccardo Graziosi" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="This post is here to test <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mrow><mpadded voffset="-0.55ex"><mstyle scriptlevel="0" displaystyle="false"><mtext>J</mtext></mstyle></mpadded><mspace width="-0.1293em"/><mtext>E</mtext><mspace width="-0.1077em"/><mpadded voffset="-0.5ex"><mstyle scriptlevel="0" displaystyle="false"><mtext>K</mtext></mstyle></mpadded><mspace width="-0.3017em"/></mrow><mtext>TeX</mtext></mrow><annotation encoding="application/x-tex">\jektex</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.9204em;vertical-align:-0.2371em;"></span><span class="mord text"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.4463em;"><span style="top:-2.763em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">J</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.2371em;"><span></span></span></span></span><span class="mspace" style="margin-right:-0.1293em;"></span><span class="mord">E</span><span class="mspace" style="margin-right:-0.1077em;"></span><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.4678em;"><span style="top:-2.7845em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">K</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.2155em;"><span></span></span></span></span><span class="mspace" style="margin-right:-0.3017em;"></span></span><span class="mord text"><span class="mord textrm">T</span><span class="mspace" style="margin-right:-0.1667em;"></span><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.4678em;"><span style="top:-2.7845em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord textrm">E</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.2155em;"><span></span></span></span></span><span class="mspace" style="margin-right:-0.125em;"></span><span class="mord textrm">X</span></span></span></span></span>, a lightweight jekyll plugin for LaTeX rendering <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext>LaTeX</mtext></mrow><annotation encoding="application/x-tex">\LaTeX</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8988em;vertical-align:-0.2155em;"></span><span class="mord text"><span class="mord textrm">L</span><span class="mspace" style="margin-right:-0.36em;"></span><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.6833em;"><span style="top:-2.905em;"><span class="pstrut" style="height:2.7em;"></span><span class="mord"><span class="mord textrm mtight sizing reset-size6 size3">A</span></span></span></span></span></span><span class="mspace" style="margin-right:-0.15em;"></span><span class="mord text"><span class="mord textrm">T</span><span class="mspace" style="margin-right:-0.1667em;"></span><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.4678em;"><span style="top:-2.7845em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord textrm">E</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.2155em;"><span></span></span></span></span><span class="mspace" style="margin-right:-0.125em;"></span><span class="mord textrm">X</span></span></span></span></span></span>." />
<meta property="og:description" content="This post is here to test <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mrow><mpadded voffset="-0.55ex"><mstyle scriptlevel="0" displaystyle="false"><mtext>J</mtext></mstyle></mpadded><mspace width="-0.1293em"/><mtext>E</mtext><mspace width="-0.1077em"/><mpadded voffset="-0.5ex"><mstyle scriptlevel="0" displaystyle="false"><mtext>K</mtext></mstyle></mpadded><mspace width="-0.3017em"/></mrow><mtext>TeX</mtext></mrow><annotation encoding="application/x-tex">\jektex</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.9204em;vertical-align:-0.2371em;"></span><span class="mord text"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.4463em;"><span style="top:-2.763em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">J</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.2371em;"><span></span></span></span></span><span class="mspace" style="margin-right:-0.1293em;"></span><span class="mord">E</span><span class="mspace" style="margin-right:-0.1077em;"></span><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.4678em;"><span style="top:-2.7845em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord">K</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.2155em;"><span></span></span></span></span><span class="mspace" style="margin-right:-0.3017em;"></span></span><span class="mord text"><span class="mord textrm">T</span><span class="mspace" style="margin-right:-0.1667em;"></span><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.4678em;"><span style="top:-2.7845em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord textrm">E</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.2155em;"><span></span></span></span></span><span class="mspace" style="margin-right:-0.125em;"></span><span class="mord textrm">X</span></span></span></span></span>, a lightweight jekyll plugin for LaTeX rendering <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mtext>LaTeX</mtext></mrow><annotation encoding="application/x-tex">\LaTeX</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.8988em;vertical-align:-0.2155em;"></span><span class="mord text"><span class="mord textrm">L</span><span class="mspace" style="margin-right:-0.36em;"></span><span class="vlist-t"><span class="vlist-r"><span class="vlist" style="height:0.6833em;"><span style="top:-2.905em;"><span class="pstrut" style="height:2.7em;"></span><span class="mord"><span class="mord textrm mtight sizing reset-size6 size3">A</span></span></span></span></span></span><span class="mspace" style="margin-right:-0.15em;"></span><span class="mord text"><span class="mord textrm">T</span><span class="mspace" style="margin-right:-0.1667em;"></span><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:0.4678em;"><span style="top:-2.7845em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord textrm">E</span></span></span></span><span class="vlist-s"></span></span><span class="vlist-r"><span class="vlist" style="height:0.2155em;"><span></span></span></span></span><span class="mspace" style="margin-right:-0.125em;"></span><span class="mord textrm">X</span></span></span></span></span></span>." />
<link rel="canonical" href="[http://localhost:4000/no-style-please/jektex-post.html](view-source:http://localhost:4000/no-style-please/jektex-post.html)" />
<meta property="og:url" content="http://localhost:4000/no-style-please/jektex-post.html" />
<meta property="og:site_name" content="no style, please!" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2023-02-03T00:00:00+01:00" />
<meta name="twitter:card" content="summary" />
<meta property="twitter:title" content="Jektex Post" />
<script type="application/ld+json">
{"headline":"Jektex Post","dateModified":"2023-02-03T00:00:00+01:00","datePublished":"2023-02-03T00:00:00+01:00","@type":"BlogPosting","author":{"@type":"Person","name":"Riccardo Graziosi"},"mainEntityOfPage":{"@type":"WebPage","@id":"http://localhost:4000/no-style-please/jektex-post.html"},"url":"http://localhost:4000/no-style-please/jektex-post.html","description":"This post is here to test \<span class="katex-error" title="ParseError: KaTeX parse error: Expected &#x27;EOF&#x27;, got &#x27;}&#x27; at position 109: …s://schema.org&quot;}̲&lt;/script&gt;
&lt;!-- …" style="color:#cc0000">\\jektex\\), a lightweight jekyll plugin for LaTeX rendering \\(\\LaTeX\\).&quot;,&quot;@context&quot;:&quot;https://schema.org&quot;}&lt;/script&gt;
&lt;!-- End Jekyll SEO tag --&gt;
&lt;link type=&quot;application/atom+xml&quot; rel=&quot;alternate&quot; href=&quot;http://localhost:4000/no-style-please/feed.xml&quot; title=&quot;no style, please!&quot; /&gt;&lt;link rel=&quot;shortcut icon&quot; type=&quot;image/x-icon&quot; href=&quot;/no-style-please/logo.png&quot; /&gt;
  &lt;link rel=&quot;stylesheet&quot; href=&quot;/no-style-please/assets/css/main.css&quot; /&gt;
  &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css&quot; integrity=&quot;sha384-MlJdn/WNKDGXveldHDdyRP1R4CTHr3FeuDNfhsLPYrq2t0UBkUdK2jyTnXPEK1NQ&quot; crossorigin=&quot;anonymous&quot;&gt;
&lt;/head&gt;

Is there a way to escape quotes in the tags ?

@yagarea yagarea changed the title This plugin renders invalid html head if article contains latex equasion This plugin renders invalid html head if article contains raw html Mar 2, 2024
@ghost
Copy link

ghost commented Apr 5, 2024

bump

@ffes
Copy link

ffes commented Oct 28, 2024

I run info a similar problem:

See the schema.org LD+JSON of this page: https://www.fesevur.com/2024/10/20/oude-kaas-salade/

In the article is an emoji used that rendered as a bootstrap icon. <i class="bi bi-emoji-frown-fill"></i>.

In the description field in the JSON (formatted for readability) it is added as raw html:

{
  "@context":"https://schema.org",
  "@type":"BlogPosting",
  "author": {
    "@type":"Person",
    "name":"Frank Fesevur"
  },
  "dateModified":"2024-10-20T15:31:58+02:00",
  "datePublished":"2024-10-20T15:31:58+02:00",
  "description":"Als groot liefhebber van oude kaas, houd ik ook van Oude Kaassalade. Alleen vindt blijkbaar iedereen dat om de een of andere reden daar altijd mosterd in moet. Maar ik ben geen fan van mosterd, om het voorzichtig te zeggen. Dan blijft er niet zoveel keuze over. <i class="bi bi-emoji-frown-fill"></i>",
  "headline":"Oude kaassalade zonder mosterd",
  "mainEntityOfPage": {
    "@type":"WebPage",
    "@id":"https://www.fesevur.com/2024/10/20/oude-kaas-salade/"
  },
  "url":"https://www.fesevur.com/2024/10/20/oude-kaas-salade/"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants