Thanks. Yes, I guess I realised it had something to do with ambiguous grammars, but I hadn't really considered that my input was a valid table (mea culpa).

So I thought aha! I'll change the terminating "---" to "..." (in the hope of an error), but this of course gives the output shown below.

I wonder whether there could be a warning in the manual (or maybe there is and I've missed it?) and/or perhaps a suggestion that it might be a good idea to avoid complex YAML metadata blocks (in favour of metadata files)? I'd be happy to create an issue and/or a MANUAL.md pull request.

% cat bad.md
---
history:
- number: Release 1.2
  changes: |
  - TBD
...

% pandoc bad.md
<hr />
<p>history: - number: Release 1.2 changes: | - TBD …</p>



On Wed, 2 Jun 2021 at 17:47, John MacFarlane <jgm-TVLZxgkOlNX2fBVCVOL8/A@public.gmane.org> wrote:

Well, this actually IS a valid "simple table".  So how is
pandoc to know that you intended it as a YAML metadata block?
Pandoc tries first to parse things as YAML blocks, and then as
tables, if either works, the parse succeeds with no error.

William Lupton <wlupton-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> writes:

> Should I expect syntax errors in YAML blocks to be detected and reported?
>
> This has a syntax error in the YAML block:
>
> % cat bad.md
> ---
> history:
> - number: Release 1.2
>   changes: |
>   - TBD
> ---
>
> This fixes it:
>
> % diff bad.md good.md
> 5c5
> <   - TBD
> ---
>>     - TBD
>
> The latest pandoc:
>
> % ~/Downloads/pandoc-2.14.0.1/bin/pandoc -v
> pandoc 2.14.0.1
> ...
>
> Pandoc thinks the bad YAML is a table:
>
> % ~/Downloads/pandoc-2.14.0.1/bin/pandoc bad.md
> <table>
> <tbody>
> <tr class="odd">
> <td>history:</td>
> </tr>
> <tr class="even">
> <td>- number: Release 1.2</td>
> </tr>
> <tr class="odd">
> <td>changes: |</td>
> </tr>
> <tr class="even">
> <td>- TBD</td>
> </tr>
> </tbody>
> </table>
>
> But it's OK with the good YAML:
>
> % ~/Downloads/pandoc-2.14.0.1/bin/pandoc good.md
>
> Parsing the file as YAML reports the error:
>
> % ~/Downloads/pandoc-2.14.0.1/bin/pandoc --metadata-file bad.md
> Error at "bad.md" (line 5, column 0):
> Unexpected ' '
>
> % ~/Downloads/pandoc-2.14.0.1/bin/pandoc --metadata-file good.md
> ^C
>
> --
> You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxjF3Un2J-xg5UOs7uReZ5cO27TATA%2BfDY%2BAtghAsVhShA%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxiHXF5vQTwyoUVLErHXSb%2BiMQvUaodU3aPbjnJ%3DfT54dQ%40mail.gmail.com.