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

Issue: the presence of a colon in a string field causes crashes #792

Open
nathanchere opened this issue Apr 6, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@nathanchere
Copy link

Describe the bug
The presence of a colon in a non-quoted string field causes issues.

  1. The syntax highlighting mistakenly captures text beyond the first colon as part of the key.
  2. The FM activity tab sometimes appears as if no frontmatter schema or content is defined, and sometimes it just outright crashes.

To Reproduce
An example of frontmatter which breaks the Frontmatter CMS plugin for vscode:

---
title: Introducing: Star Wars 13
caption: You thought they couldn't ruin Star Wars any further. You were wrong.
---

In this case the syntax highlighting shows "title: Introducing:" as the key instead of identifying "Introducing: " as part of the value

Expected behavior
Handle it without crashing. It can be worked around by putting double-quotes around the title (which is done automatically if you enter the colon in the FM activity tab instead of directly in the code editor).

Desktop (please complete the following information):

I've reproduced it on the following:

  • Arch Linux, vscode 1.88.0, FrontMatter CMS 10.0.2
  • Arch Linux, vscodium 1.88.0, FrontMatter CMS 10.0.2
  • Windows 10, vscode 1.88, FrontMatter CMS 10.0.2
@nathanchere nathanchere added the bug Something isn't working label Apr 6, 2024
@estruyf
Copy link
Owner

estruyf commented Apr 8, 2024

Thanks, @nathanchere, for opening the issue. The YAML parser fails to parse the front matter section, and you should see the following error message:

image

Wrapping the title with quotes is the solution, but the CMS does not automatically do it as it would first need a valid YAML object to parse it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants