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

Add support for YAML arrays #6

Closed
trungng2006 opened this issue Feb 12, 2021 · 10 comments
Closed

Add support for YAML arrays #6

trungng2006 opened this issue Feb 12, 2021 · 10 comments
Assignees
Labels
feature-request New feature or request.

Comments

@trungng2006
Copy link

Hello,

While using dataview, I noticed that the plugin only render single line YAML attributes, while multi-line YAML attributes are returned as null.
EX:
Attribute:

  • Attribute1
  • Attribute2
  • Attribute3
    This will return as null.

Would it be possible to enhance the plugin by adding supports for multi-line YAML attributes?

@blacksmithgu
Copy link
Owner

By multi-line, do you mean YAML objects? If so, I think it's because obsidian's YAML parsing is incomplete. An object of the form:

attribute:
  sub: 1
  sub2: 2
  etc: 3

will parse successfully. Dataview does support nested objects in this syntax, using dots to separate the names (so attribute.sub, for example).

@blacksmithgu
Copy link
Owner

If you enable previewing frontmatter in the Obsidian options, and then look at the preview, do you get an "Invalid YAML" exception in the renderer?

@blacksmithgu blacksmithgu self-assigned this Feb 13, 2021
@blacksmithgu blacksmithgu added the bug Something isn't working. label Feb 13, 2021
@trungng2006
Copy link
Author

Im sorry for not being clear.
The multi-line I mean is multi-line arrays
image
For example, in the picture, the aliases show up null, The Key-findings also show up null

@blacksmithgu
Copy link
Owner

Ah, yes, I haven't added YAML array support yet since I wasn't sure of the best way to approach it ergonomically. I'm expecting to add support in the next few releases.

@blacksmithgu blacksmithgu added feature-request New feature or request. and removed bug Something isn't working. labels Feb 14, 2021
@trungng2006
Copy link
Author

Great! Thank you so much!

@blacksmithgu blacksmithgu changed the title Add support for multiline YAML Add support for YAML arrays Feb 22, 2021
@piotryordanov
Copy link

Any updates on this? :)

@blacksmithgu
Copy link
Owner

Incoming as part of 0.1.8 this week. It will be somewhat simple for now (contains, sort, renders properly), but should be more useful when I finish the new query engine.

@trungng2006
Copy link
Author

Great! can't wait to try it out! :D
Thank you so much!

@blacksmithgu
Copy link
Owner

Added as 0.1.8. The support is somewhat basic but I will expand it in 0.1.9.

@piotryordanov
Copy link

Can you give an example of how to use it? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request.
Projects
None yet
Development

No branches or pull requests

3 participants