Not sure if this is intentional: doing some tests for https://github.com/quarto-dev/quarto-cli/issues/175 I saw the value of `lang` as seen by a Lua filter is inconsistent with vanilla pandoc (the same happens for other metadata variables). The examples below use the following `index.qmd`:

```markdown
---
lang: fr
---

Text.
```

and the following `checklang.lua` filter:

```lua
local function dump(o, level)
    level = (level or 0) + 1
    indent = '    '
    if type(o) == 'table' then
        local s = '{\n'
        for k,v in pairs(o) do
            if type(k) ~= 'number' then k = '"'..k..'"' end
            s = s .. indent:rep(level) .. '['..k..'] = ' .. dump(v, level) .. ',\n'
        end
        return s .. indent:rep(level-1) .. '}'
    else
        return tostring(o)
    end
end

function Meta(meta)
    print('@@@ meta.lang:', dump(meta.lang))
    return nil
end
```

**Observations**

1. Running `pandoc index.qmd -L checklang.lua` shows:

   ```
   @@@ meta.lang:	{
       [1] = {
           ["text"] = fr,
       },
   }
   ```

1. Running `quarto render index.qmd -L checklang.lua` shows

   ```
   @@@ meta.lang:	{
       [1] = Str "fr",
   }
   ```

Now I remove the metadata header in `index.qmd` and use `-M lang` instead:

1. Running `pandoc index.qmd -L checklang.lua -M lang=fr` shows:

   ```
   @@@ meta.lang:	fr
   ```

1. Running `quarto render index.qmd -L checklang.lua -M lang=fr` shows the same thing:

   ```
   @@@ meta.lang:	fr
   ```

So pandoc itself is not consistent (maybe that's expected?) but quarto introduces a third way of storing the metadata value. This looks like something that will be annoying for filter writers?
2021-11-10T15:37:20Z
knuesel
closed
Metadata block stores values differently from vanilla pandoc
https://github.com/quarto-dev/quarto-cli/issues/177