Include YAML files
Hello, everyone,
I am facing a problem with the inclusion of the YAML file. I tried all three variants, which all behave the same:
<<[FILE]
<<(FILE)
<<{FILE}
If I use a file without a value in the first line, everything works fine:
author:
name: Test Test
email: [email blocked]
If I use a file with anything else in the first line, nothing at all is displayed.
name: Test Test
email: [email blocked]
Am I doing something wrong or is it an error?
Greeting,
Reto
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Brett on 22 Apr, 2020 08:05 PM
If you’re including this at the top of a file and are using MultiMarkdown, the values are being interpreted as metadata. I’m not sure what you’re trying to do with the included YAML. Do you want it to appear in the document, or be interpreted some other way?
Thanks,
Brett
2 Posted by Reto on 23 Apr, 2020 07:18 AM
Thank you, Brett, for your answer.
I am writing a documentation about Grav where I want to include the config files which are all written in YAML.
I understand that YAML is interpreted as metadata while including MultiMarkdown files using
<<[FILE]
.But to interpret any data while including files using
<<(FILE)
or<<{{FILE}
doesn't make sense to me.What is your opinion on this?
Greetings,
Reto
Support Staff 3 Posted by Brett on 23 Apr, 2020 12:01 PM
You're correct, that is odd behavior, especially since it's true even
when the included file isn't at the top and it happens even when MMD
isn't selected. I don't have an immediate explanation or fix, but if you
include a blank line at the beginning of the YAML file, it appears to
circumvent the issue (though leaves a blank line at the top of the code
block).
I'll look into it further, but let me know if that helps for now.
Thanks,
Brett
4 Posted by Reto on 24 Apr, 2020 08:01 AM
The workaround with the blank line at the top of the file works for me. Thank you.
For the
<<(FILE)
include syntax I have a few ideas which would make it even more useful in my opinion:- Definition of a language similar to the code block syntax - Line numbering - Include just line Y to Z of a file
Best regards,
Reto
Support Staff 5 Posted by Brett on 24 Apr, 2020 10:00 AM
Those are great ideas, I'll take them into consideration.
-Brett