question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

YAML front matter parser does not strip single or double quotes on scalars

See original GitHub issue

Steps to reproduce the problem (provide example Markdown if applicable):

---
title: 'Sixteen corners'
layout: post
---

Last year

Expected behavior:

frontMatter["title"].single() == "Sixteen corners"

Actual behavior:

Screen Shot 2022-05-18 at 10 56 24 PM

Note the retained single quotes (') surrounding the value. This is also a problem with double quotes (").

YAML spec dictates behavior on unquoted, single-quoted, and double-quoted scalars: https://yaml.org/spec/1.2.2/#73-flow-scalar-styles

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
JakeWhartoncommented, Jun 2, 2022

Yep! Looks good.

0reactions
robinstcommented, Jun 2, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Strings in YAML - To Quote or not to Quote | tinita [blogs.perl.org]
A double quoted scalar has the same rules as a single quoted scalar, plus some extra rules and escape sequences. This is the...
Read more >
Anisble Yaml file formating for quotes - ansible - Stack Overflow
YAML processes escape sequences in double-quoted scalars, so you should use regexp: "name: 'traefikExporter',[\\n\\r].*[\\n\\r]".
Read more >
Quotes are automatically ignored · Issue #434 - GitHub
When deserializing the yaml file, it completely ignores the quotes around it. So when serializing the transformed object back to a yaml file...
Read more >
YAML Ain't Markup Language (YAML™) revision 1.2.2
YAML's flow scalars include the plain style (most examples thus far) and two quoted styles. The double-quoted style provides escape sequences.
Read more >
Tips, Tricks, Troubleshooting - yq - GitBook
Yaml files can be surprisingly lenient in what can be parsed as a yaml file. ... it is valid yaml to have scalars...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found