decker-edu / decker

A markdown based tool for slide deck creation.
GNU General Public License v3.0
60 stars 15 forks source link

HTML in meta variables is escaped when in 'decker.yaml' but not inside of '-deck.md'-Frontmatter #114

Open salbeira opened 6 months ago

salbeira commented 6 months ago

The title describes it all.

While there are moments where you may not want HTML to be escaped when placed inside config- / meta-variables this is diverging behavior.

This should be equalized and variables that should not be escaped should have a mechanism to declare them as "unescaped".

If there does already exist such a mechanism it is not documented anywhere (inside this project).

monofon commented 6 months ago

Please give me an example when that happens. What are the HTML values, where do you set them, where and how do you reference them?

salbeira commented 6 months ago

Inside decker.yaml:

watermark: '<img src="foo.png">'

becomes the text <img src="foo.png"> as a watermark.

Inside -deck.md:

watermark: '<img src="foo.png">'

becomes the image.

The variable is evaluated inside the template:

  $if(watermark)$
  <div class="watermark">
    $watermark$
  </div>
  $endif$
monofon commented 6 months ago

I see.

Pandoc parses metadata values in the document as Markdown, recognizes plain HTML and converts it to an inline Image.

The YAML parser used for .yaml files does not do that and handles the value as a string.

At some point the values from the YAML parser are converted to Pandoc Meta values. We could try to parse the string values with Pandoc and replace them with whatever comes out of that. This has the potential to break a lot of things.

Postponed until after the next milestone.

flipreverse commented 5 months ago

@monofon Which tool do you use for parsing the metadata?

monofon commented 5 months ago

The standard Haskell YAML parser:

flipreverse commented 5 months ago

The standard Haskell YAML parser:

* https://hackage.haskell.org/package/yaml

Does it have something like a escape flag? That could be easily disabled when calling that library.

monofon commented 3 months ago

Parse decker.yaml meta values as markdown if possible.

In any case, meta values as template data should behave the same regardless where they are defined.