sergioramos/remark-prism

Some languages are not detected, some quotes are encoded.

Closed this issue · 2 comments

I'm using remark-prism in my nextjs blog. I figured some quotes are changed to encodings where I am using language conf.

See here I'm using some nginx config.

https://nextjs-blog-git-feature-blog-posts.marcofranssen.vercel.app/posts/202008-nginx-1-19-supports-environment-variables-and-templates-in-docker

The issue with that codeblock is that it shows a " as ".

The code I'm using to transform my markdown is this. When I disable the use(prism) line the " is shown as " accordingly.

import remark from "remark";
import html from "remark-html";
import prism from "remark-prism";
import gfm from "remark-gfm";

export default async function markdownToHtml(markdown) {
  const processedContent = await remark()
    .use(gfm)
    .use(prism)
    .use(html)
    .process(markdown);

  return processedContent.toString();
}

The markdown that renders the nginx block looks like this. As you can see here on github it renders accordingly as well on my current version of my blog. https://marcofranssen.nl/nginx-1-19-supports-environment-variables-and-templates-in-docker/#Setting-the-scene (highlights)

```conf default.conf.template
server {
    listen       ${NGINX_PORT};
    listen       [::]:${NGINX_PORT};
    server_name  localhost;

    gzip on;
    gzip_disable "msie6";

    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 6;
    gzip_buffers 16 8k;
    gzip_http_version 1.1;
    gzip_min_length 0;
    gzip_types text/plain application/javascript text/css text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype;

    root   /usr/share/nginx/html;
}
```

Other code blocks using quotes render properly on my webpage as you can see except for this particular example that I found so far.

Do you have any idea on how to fix this? Is there an option to also render the default.conf.template like I do on my current webpage? https://marcofranssen.nl/nginx-1-19-supports-environment-variables-and-templates-in-docker/#Setting-the-scene

I found the solution. It seems there is a specific language called nginx.

https://prismjs.com/#supported-languages

This resolves the issue with rendering those accordingly.

I would refer to the encoding issue here: #85