marp-vscode
marp-vscode copied to clipboard
handle yaml parse errors to user
If user set in title or another unhandled expressions something like
-
title: Title: some expensive description
in his header In this case we will haveNested mappings are not allowed in compact mappings
from parser. or -
footer: [link address](http://localhost:8080)
in his slides dirrectives
he know nothing about parce error and about unreachable dirrectives parse (if we talk about frontMatter marp-vscode try parse all header https://github.com/marp-team/marp-vscode/blob/57d95aad81432b3af5d98c55e26be214dba808e3/src/directives/parser.ts#L67-L67 and if one of the dirrectives was failed another such as headingDivider
does not parse anymore and dont apply to marp).
i have research this behavior - parsing is valid. It is also reproduce with standalone parse library https://runkit.com/akaguny/61c39bdd45f2720008b8831b#
My dummy but minimum solution is add something like this (commit for this https://github.com/akaguny/marp-vscode/commit/0f9a1d44f465bdd5018b9a964da4f9fc37fb0972):
} else {
errors.forEach((error) => {
window.showErrorMessage(error.message)
})
}
at https://github.com/marp-team/marp-vscode/blob/57d95aad81432b3af5d98c55e26be214dba808e3/src/directives/parser.ts#L99-L99
result is messages like:
and
this is messages from parser. Good for "googling"
We have no plans to fix that. An invalid state as YAML will often bring sometimes while input of directives. Showing parse error every time while typing is not good design for users who want to focus into writing slides.
We have already provided a hover help about invalid YAML syntax:
@yhatt not for all dirrrectives. I gave spent a lot of time for find error in dirrective. When i have an error with yaml on first line another lines was ignored and render result was rediculas) . I expect 20 slides but in render got 2 and at now i also have not idea how it render ). I can prepare some example for showing)