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

Bug: Headers starting with an alias break the YAML array #604

Closed
1 of 2 tasks
Martin-Milbradt opened this issue Jan 27, 2023 · 3 comments · Fixed by #605
Closed
1 of 2 tasks

Bug: Headers starting with an alias break the YAML array #604

Martin-Milbradt opened this issue Jan 27, 2023 · 3 comments · Fixed by #605
Assignees
Labels
bug Something isn't working markdown General Markdown or Markdown related issue or feature resolution/update-made A change has been made that should resolve this issue or request

Comments

@Martin-Milbradt
Copy link

Martin-Milbradt commented Jan 27, 2023

Describe the Bug

A title starting with an aliased reference get's parsed in the YAML as "note: |...". The pipe is wrong and causes errors on save.

How to Reproduce

Steps to reproduce the behavior:

  1. Create new obsidian document
  2. Give it an alias
  3. Reference the alias at the start of the title
  4. Hit save to create the YAML array
  5. Notice that the YAML contains "note: |..."
  6. Save again and get an error message
  7. Check the console for the error details

Example to reproduce issue with:

---
note: |Broken Linter
aliases: Broken
---

# [[Broken Linter|Broken]] Linter

Linter Log

Running linter
Running Format Tags in YAML
Running Escape YAML Special Characters
Running Format Yaml Array
Lint File Error in File 'ZZ_Other/Broken Linter.md':
Error "Format Yaml Array" encountered an error in the yaml:  a line break is expected (1:8)

 1 | note: |Broken Linter
------------^
 2 | created: 2023-01-27 12:51:35
 3 | modified: 2023-01-27 12:52:08
YAMLException: a line break is expected (1:8)

 1 | note: |Broken Linter
------------^
 2 | created: 2023-01-27 12:51:35
 3 | modified: 2023-01-27 12:52:08
    at ql (plugin:obsidian-linter:18:944)
    at P (plugin:obsidian-linter:18:978)
    at As (plugin:obsidian-linter:18:3294)
    at wp (plugin:obsidian-linter:19:4029)
    at qt (plugin:obsidian-linter:25:4899)
    at kp (plugin:obsidian-linter:25:2150)
    at qt (plugin:obsidian-linter:25:4870)
    at Op (plugin:obsidian-linter:25:7247)
    at _l (plugin:obsidian-linter:26:258)
    at Ep (plugin:obsidian-linter:26:469)

Expected Behavior

Expected output if applicable:

"note:" doesn't start with a pipe.

---
note: Broken Linter
aliases: Broken
---

# [[Broken Linter|Broken]] Linter

Screenshots

image
image

Device

  • Desktop
  • Mobile

Additional Context

  • It worked in the past. I have notes from earlier this month starting with an aliased reference. "note:" looks like this (it breaks when I save):
note: '[[Tittle|Alias]] more text [[Reference]]'
@Martin-Milbradt Martin-Milbradt added the bug Something isn't working label Jan 27, 2023
@pjkaufman
Copy link
Collaborator

This seems related to a different change @TrueMilli . #603 was added yesterday evening and has not officially been released. So unless you pulled in that change manually by building it yourself today, it is a different issue. This likely relates to #511 which is a change that was added in November. This hopefully will be a simple 1 line fix.

@pjkaufman
Copy link
Collaborator

Looks like a simple fix. I need to add the appropriate UT for this and then it should be go to. Thanks for reporting this!

@pjkaufman pjkaufman added the markdown General Markdown or Markdown related issue or feature label Jan 27, 2023
@pjkaufman pjkaufman self-assigned this Jan 27, 2023
@github-project-automation github-project-automation bot moved this from Backlog to Releasing in Obsidian Linter Jan 27, 2023
@pjkaufman pjkaufman added the resolution/update-made A change has been made that should resolve this issue or request label Jan 27, 2023
@pjkaufman
Copy link
Collaborator

This issue should be fixed on master and in the next release. Please let us know if that is not the case.

Note that you will need to manually fix any currently messed up YAML values.

@pjkaufman pjkaufman moved this from Releasing to Done in Obsidian Linter Feb 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working markdown General Markdown or Markdown related issue or feature resolution/update-made A change has been made that should resolve this issue or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants