pngwn / MDsveX

A markdown preprocessor for Svelte.
https://mdsvex.pngwn.io
MIT License
2.27k stars 96 forks source link

Rendering issue for bolds and links when opening page directly rather than navigating to it #566

Open ildella opened 4 months ago

ildella commented 4 months ago

Hi. I am experiencing this weird behaviour, on both Firefox and Chromium on Ubuntu.

Go here: https://www.frankie-gpt.com/blog/authentication-with-public-key-cryptography You will probably see that all links and bold are without spaces before and after.

Screenshot from 2024-02-12 10-01-16

Now if one goes to the main Blog index and clicks on the article, the rendering errors are not there.

What can possibly be the cause?

This is using SvelteKit 1.30 and mdsvex 0.11. Here are some config files:

const config = {
  kit: {
    adapter: adapter(),
    prerender: {
      handleHttpError: ({path, referrer, message}) => {
        if (path === '/not-found' && referrer === '/blog/how-we-built-our-404-page') {
          return
        }
        throw new Error(message)
      },
    },
  },
  preprocess: [
    mdsvex(mdsvexConfig),
    vitePreprocess({}),
  ],
  extensions: [
    '.svelte',
    ...mdsvexConfig.extensions,
  ],
}

export default {
  extensions: ['.md'],
  smartypants: {dashes: 'oldschool'},
}
ildella commented 4 months ago

I've just upgraded to latest SvelteKit 2.5, vite 5.1 and still problem is there.

It must be something in my code but I have no clue where to start looking.

ildella commented 4 months ago

I "fixed" it removing html-minifier-terser in hooks.server

export function handle ({event, resolve}) {
 return resolve(event, {transformPageChunk: ({html}) => minify(html, minificationOptions)})
}

This is now commented. I'll explore how to minify stuff built with MDsvex.

pngwn commented 4 months ago

Hmmm, this is weird.