Skip to content

[Yaml] Double quote strings containing single quotes #41687

Closed
@Ostrzyciel

Description

@Ostrzyciel

Description
Currently Yaml::dump uses double quotes only when it's absolutely needed. Thus, strings containing ' are not double-quoted and instead the single quote is escaped (' -> ''). This is fine for regular text, but becomes slightly annoying with certain markup languages, such as MediaWiki's wikitext.

My request is to make the Dumper use double quotes when there are single quotes within dumped text, to improve readability.

Example
When calling the following code:

Yaml::dump("'''bold'''")

(the three single quotes signify bold text in MediaWiki)

Output before: '''''''bold'''''''
Output after: "'''bold'''"

The second one is much more readable.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions