Add an option to include arbitrary YAML documents #117
Labels
feature request
lua
Related to the Lua interface and implementation
yaml
Related to the tinyyaml library.
Milestone
Since #22, the Markdown package supports YAML metadata in markdown documents. The metadata may appear anywhere in a markdown document, but they must begin with three dashes (
---
) and end with either three dashes of three dots (...
), which is vaguely in the spirit of the YAML spec and compatible with Pandoc.Due to the separators, we can't include arbitrary YAML documents using the
\markdownInput
command:There is a good reason for this behavior, too. For example, many documents would be ambiguous without the separators:
However, it would be neat if we could ask the Markdown package to give preference to YAML when things are ambiguous.
I propose to add a boolean option (for example
jekyllDataAlways
orexpectJekyllData
). When enabled, the option would ask Markdown to assume that Markdown documents always begin with a YAML metadata block. In practice, the option would make the surrounding---
and...
optional for YAML metadata that appear at the very beginning of a markdown document:One alternative would be to overload the current
jekyllData
option and make it mixed rather than boolean (the valid values would befalse
or"never"
,true
or"explicit"
, and"always"
). However, this would require a smarter type casting code in the Lua CLI (or perhaps drop the booleans?).Another alternative would be to add a separate command (for example
\yamlInput
) for this. However, I plan to keep the surface area of markdown small and such a command sounds like it belongs to a separate package. Additionally, the above approach is more general and allows users to define\yamlInput{#1}
as\markdownInput[jekyllData, expectJekyllData]{#1}
.The text was updated successfully, but these errors were encountered: