Notate the following setting in TOML instead of JS:
~ js
module.exports = {
head: [
['link', { rel: 'icon', href: '/logo.png' }]
]
}
~
Which in theory would be:
~ toml
head = [
["link", { rel = "icon", href = "/logo.png" }]
]
~
‒
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.
~ toml
one = [1, 2] # ok
two = ["a", "b"] # ok
three = [1, "a"] # error
~
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):
~ toml
[[head]]
tag = "link"
attributes = [
['rel', 'icon'],
['href', '/logo.png']
]
~
Which would be equivalent to this JS:
~ js
module.exports = {
head: [
{ tag: 'link', attributes: [['rel', 'icon'], ['href', '/logo.png']] }
]
}
~
npx vuepress info in my VuePress project:I don't think that's relevant here.
This is a problem for us as well.
Workaround for now:
[[head.0]]
0 = "link"
1 = { rel = "logo", href = "/logo.png" }
Good news: It looks like this won't be an issue anymore with TOML 1.0: https://github.com/toml-lang/toml/pull/676
Most helpful comment
Good news: It looks like this won't be an issue anymore with TOML 1.0: https://github.com/toml-lang/toml/pull/676