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

Missing line breaks in code snippet #166

Closed
guillett opened this issue May 31, 2020 · 5 comments
Closed

Missing line breaks in code snippet #166

guillett opened this issue May 31, 2020 · 5 comments

Comments

@guillett
Copy link
Contributor

Many thanks for your loader 🙏!

I tried to add code snippets into some on my .md documents in a NextJS project and statically exported site. These snippets are not properly rendered. More precisely line breaks are, somehow removed and the full content get displayed on a single line.

I tried to dig into your loader and markdownIt but I got lost.
Have you ever heard about similar issue with NextJs and code snippets?
Would you have insights to share and helpp me troubleshoot that limitation?

Many thanks,

Working example:
File:
https://github.com/mes-aides/simulateur/blob/demo-break-code/contribuer/content/home.md

Render:
https://deploy-preview-48--mes-aides.netlify.app/

Project root:
https://github.com/mes-aides/simulateur/tree/demo-break-code/contribuer

(Another file:
https://github.com/mes-aides/simulateur/blob/demo-break-code/contribuer/content/tasks/ajouter-une-aide.md#v%C3%A9rifier-que-votre-environnement-est-fonctionnel---12-minutes-max

Render:
https://deploy-preview-48--mes-aides.netlify.app/tasks/ajouter-une-aide
In H2 « Préparer l'environnement de travail - 10 minutes max », H3 « Vérifier que votre environnement est fonctionnel - 12 minutes max »
)

(Plus I have a React warning, Warning: Invalid DOM property class. Did you mean className? but that's may be unrelated).

@hmsk
Copy link
Owner

hmsk commented Jun 1, 2020

Thanks for bringing this to my attention! Looks it's unintentional behavior and I'm going to look into soon.

React warning

It's fixed on v3.4.2: https://github.com/hmsk/frontmatter-markdown-loader/releases/tag/v3.4.2 😉

hmsk added a commit that referenced this issue Jun 2, 2020
@hmsk
Copy link
Owner

hmsk commented Jun 2, 2020

Released a quickfix as a beta 3.6.0-0: https://www.npmjs.com/package/frontmatter-markdown-loader/v/3.6.0-0
Could you try this?

@guillett
Copy link
Contributor Author

guillett commented Jun 3, 2020

Many thanks for you fast quickfix 😍!

It worked with simple situations.

However I got an error with the following file


title: title

Some text.

Some raw content.

With some inline code awesome command, it messes with the REGEX.

I saw your quickfix, I feel like you loader should rely on an HTML parser (I think I read a comment stating that you tried to avoid adding such dependency).

@hmsk
Copy link
Owner

hmsk commented Jun 3, 2020

Thanks for confirming!
Yeah, it must be the time to welcome HTML parser finally. Let me have more time for that. I'm so excited since HTML parser enables us to write more feasible codes ✨ Another beta release of v3.6.0 will come.

@hmsk
Copy link
Owner

hmsk commented Jun 16, 2020

Released v3.6.0 https://github.com/hmsk/frontmatter-markdown-loader/releases/tag/v3.6.0

Additionally, I fixed another class vs className problem and some corner cases I found in my test apps. I'm closing this PR, but happy to hear back from you whenever.

@hmsk hmsk closed this as completed Jun 16, 2020
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