Description
- I confirm that this is an issue rather than a question.
Bug report
Steps to reproduce
Notate the following setting in TOML instead of JS:
module.exports = {
head: [
['link', { rel: 'icon', href: '/logo.png' }]
]
}
Which in theory would be:
head = [
["link", { rel = "icon", href = "/logo.png" }]
]
What is expected?
‒
What is actually happening?
The TOML extension of VS Code reports: "Cannot add value of type InlineTable to array of type String. Toml Parser" - which is correct. Arrays in TOML only support values of the same type. The array at head[0]
contains a mix of String
and InlineTable
though, which is not supported.
one = [1, 2] # ok
two = ["a", "b"] # ok
three = [1, "a"] # error
Other relevant information
There's an issue on the TOML repository about mixed typed arrays. TL;DR is: Some programming languages don't support arrays with mixed values, so it's safer to not support that in TOML either. That makes TOML files easier to read in more languages.
To fully support TOML config files the config structure needs to be changed at some points. Removing TOML support would be a bummer though, because I like the format.
One alternative example for the head
config (TOML):
[[head]]
tag = "link"
attributes = [
['rel', 'icon'],
['href', '/logo.png']
]
Which would be equivalent to this JS:
module.exports = {
head: [
{ tag: 'link', attributes: [['rel', 'icon'], ['href', '/logo.png']] }
]
}
- Output of
npx vuepress info
in my VuePress project:
I don't think that's relevant here.