Opening this issue to discuss how `--metadata-files` is supposed to work. 

This short example is working 
````markdown
---
author: "me"
format: html
metadata-files: 
  - meta.yml
---

# Hello

World 
````

where `meta.yml` is 
````yaml
title: My Document
````

I would have expected the equivalent command line to work too if the file was not passed through yaml
````markdown
---
author: "me"
format: html
---

# Hello

World 
````

````sh
quarto render test.qmd --metadata-file=meta.yml
````

But in that case the title is not set. The metadata does not see 

I look through the code @dragonstyle and have some question - maybe you can help.
https://github.com/quarto-dev/quarto-cli/blob/1fd5db82b8d757ff9425247dc3660d037ff63322/src/command/render/flags.ts#L286-L294

`readYamlFromMarkdownFile` returns a promise I believe after calling `readAndValidateYamlFromMarkdown`
https://github.com/quarto-dev/quarto-cli/blob/1fd5db82b8d757ff9425247dc3660d037ff63322/src/core/yaml.ts#L179-L185

and `readAndValidateYamlFromMarkdown` seems to expect a YAML block with `---` surrounding. I don't think `--metadata-file` is expecting that with Pandoc. 

When `metadata-files` is uses in YAML, the function used is `readAndValidateYamlFromFile` 
https://github.com/quarto-dev/quarto-cli/blob/1fd5db82b8d757ff9425247dc3660d037ff63322/src/config/metadata.ts#L60-L70
which is a different function so the two way of reading the same file - it does not seem right 🤔 

Anyway, I'll keep looking, but wanted to share so that maybe you can help @dragonstyle - am I missing something ? 

thanks! 
cscheid
2022-04-12T09:36:28Z
cderv
closed
Using --metadata-file to set metadata does not seem to work properly
https://github.com/quarto-dev/quarto-cli/issues/613