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

VSCode - format slides.md - break the build #854

Closed
deleonio opened this issue Jan 30, 2023 · 16 comments · Fixed by #1186
Closed

VSCode - format slides.md - break the build #854

deleonio opened this issue Jan 30, 2023 · 16 comments · Fixed by #1186

Comments

@deleonio
Copy link

Describe the bug
If I format the markdown file - the build break.

before

---
layout: center-layout
---

after formatting

---

## layout: center-layout

To Reproduce
Steps to reproduce the behavior:

  1. Run the dev
  2. Go to slides.md
  3. Make some slides with different layouts
  4. Format the Markdown file slides.md
  5. See the error

Desktop (please complete the following information):

  • OS: Mac
  • Browser: Chrome
  • Slidev version: 0.39
@yozachar
Copy link

This happens if you're using either Markdownlint or Prettier as formatter. If you use MarkdownAllInOne instead, that particular change does not happen.

Not so cool suggestion: Adding a formatter to slidev-vscode

@maxandron
Copy link

A cool suggestion would be to add a prettier parser :D

@emersonbottero
Copy link

I just add an the prettier config file in the root disabling it for .md

@stale
Copy link

stale bot commented Apr 2, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Apr 2, 2023
@stale stale bot closed this as completed Apr 9, 2023
@wycats
Copy link

wycats commented Apr 11, 2023

I think this should be reopened. It's probably my biggest pain point with slidev atm.

@jakebailey
Copy link

I've so far gotten through this with <!-- prettier-ignore-start --> or <!-- dprint-ignore-start -->, like:

<!-- prettier-ignore-start -->

---
layout: fact
---

<!-- prettier-ignore-end -->

But, another way to do this would be great.

@maxandron
Copy link

@jakebailey this is very cool! I didn't know this option existed. Thanks!

Now creating a workaround is quite simple: https://gist.github.com/maxandron/ce7ca54f2e808dadd209e34ebe751f92

@jakebailey
Copy link

That works for those who only run prettier separately; I format in my editor, so, I think an alternative way to write these blocks would be still great.

Maybe:

---
title: the first one is okay
---

# Blah

---

<v-config>
layout: fact
</v-config>

# This is a fact!

Or something. Unfortunate that this repo uses the stale bot, though; this is the second filing of this 😢

@CodyBontecou
Copy link
Contributor

This happens if you're using either Markdownlint or Prettier as formatter. If you use MarkdownAllInOne instead, that particular change does not happen.

Not so cool suggestion: Adding a formatter to slidev-vscode

@joe733 I switched over to MarkdownAllInOne but am not getting any formatting on save.

@yozachar
Copy link

yozachar commented Jul 26, 2023

@CodyBontecou format-on-save is a VSCode feature. https://code.visualstudio.com/updates/v1_6#_format-on-save

@naramdash
Copy link

my suggestion is using .prettierignore that content below

**/*.md

@antfu antfu reopened this Jan 31, 2024
@antfu antfu removed the stale label Jan 31, 2024
@antfu
Copy link
Member

antfu commented Jan 31, 2024

I think it might be worth having a custom, prettier plugin/parser. As I don't have much knowledge about Prettier (nor really using it), I might not have enough incentive to work on it very soon. Would appreciate if someone is interested in giving it a try

@antfu
Copy link
Member

antfu commented Jan 31, 2024

Meanwhile #1186 might be a good solution that works today

@jakebailey
Copy link

jakebailey commented Jan 31, 2024

Aha, that does appear like it would do the trick. Unfortunately, I just tried it out locally and it didn't work 🙁

I get this:

(removed image, it's wrong)

Uploaded to https://github.com/jakebailey/talk-ts-congress-2023/tree/new-frontmatter; this is page 12.

(That being said, if this did work and were documented, I would personally be happy with this issue being closed.)

@jakebailey
Copy link

I'm an idiot; I ran pnpm update and thought it updated, but since it was in a 0.x bump it didn't automatically do it. Now on the latest version it works great!

(So, IMO this can be closed; sorry I didn't notice that PR.)

@antfu
Copy link
Member

antfu commented Jan 31, 2024

Created #1261 to track on Prettier

@antfu antfu closed this as completed Jan 31, 2024
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

Successfully merging a pull request may close this issue.

9 participants