mfontanini / presenterm

A markdown terminal slideshow tool
https://mfontanini.github.io/presenterm/
BSD 2-Clause "Simplified" License
1.19k stars 29 forks source link

Leniency flag for cross compatibility #189

Closed thisismygitrepo closed 7 months ago

thisismygitrepo commented 7 months ago

The program is strict in its parsing (and it should be) but can we have it to be lenient when we explicitly ask for it (e.g. using a flag or config)? Usecase: SSH to some machine and there is markdown slides written in one of many other popular tools.

Concretely, I got the following error:

invalid presentation metadata: unknown field `marp`, expected one of `title`, `sub_title
`, `author`, `theme`, `options` at line 2 column 1

When attempting to read

---
marp: true
size: 16:9
layout: cover
invert: true
---

<!-- class: invert -->

# Discharges expected for today using LOS model
Jan 15th 2024

I'm would be happy with any behaviour, including rendering as-is, when encountering this, instead of crashing altogether. This would vastly increase the usability of the tool in edge-cases.

Thank you.

mfontanini commented 7 months ago

I'm a bit skeptical about how the presentations will look like given they were created for some other tool that has its own commands/properties, but I'll add it as it's just an option and a simple one to implement :ok_hand:.

mfontanini commented 7 months ago

This is fixed in #190. You can now parse that example presentation using a config file like:

options:
    strict_front_matter_parsing: false
    # needed so that the `class: invert` command is ignored
    command_prefix: "presenterm:"