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

Format Tags in YAML doesn't work as expected #63

Closed
bmdesmet opened this issue Sep 21, 2021 · 3 comments · Fixed by #148
Closed

Format Tags in YAML doesn't work as expected #63

bmdesmet opened this issue Sep 21, 2021 · 3 comments · Fixed by #148

Comments

@bmdesmet
Copy link

The rule "Format Tags in YAML" doesn't handle tags in the front matter formatted like

Tags:

  • #foo
  • #Bar

Applying the linter does nothing. The expected results were

Tags:

  • foo
  • Bar

My use case for this is that I find this style of lists in YAML to be more legible and easier to edit or remove a tag. I suspect the reason I start with the # is similar to others, we want auto-complete help when assigning tags.

@theopavlove
Copy link

The rule "Format Tags in YAML" doesn't handle tags in the front matter formatted like

Tags:

  • #foo
  • #Bar

Applying the linter does nothing. The expected results were

Tags:

  • foo
  • Bar

My use case for this is that I find this style of lists in YAML to be more legible and easier to edit or remove a tag. I suspect the reason I start with the # is similar to others, we want auto-complete help when assigning tags.

To be more precise, the following case does not work as expected:

---
tags:
- #tag1
- #tag2
---

The rule format-tags-in-yaml ignores the hashes as the original regex parses only a single string.

@neldeles
Copy link

A possible implementation for this is to have options on the desired output format after parsing out the #. Workflow would be:

  1. Users type out their tags as suggested: tags: #tag1 #tag2
  2. On save it's formatted based on the format output setting chosen by user i.e. bullet points, array

I myself prefer keeping my tags in an array e.g. tags: [ tag1, tag2 ] so a feature like this would be great.

@JeppeKlitgaard
Copy link
Contributor

I also use this type of YAML list to do tags, and I think fixing this would be fantastic!

Ideally it would maintain the style used by the user, essentially just replacing the hashtags with nothing

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.

4 participants