Has anyone out there using pandoc gotten yaml file to work?

Ok, I’ve “wasted/invested” hours in to this and I simply can get my simple five lines of code to work, reliably. Evertime I think I’ve got it, it breaks.

---

suppress-bibliography:  false
reference-section-title:  REFERENCE
author: "Michael Becker"

---

I’m trying to place this yaml in my document. I’ve tried: putting it in a note, in a template, an ^include(), and a macro. I’m sure I’ve tried other stuff. No matter what I do, Tinderbox thinks it is text and formats it. I’ve also tried having pandoc reference an external .yaml file and I can’t seem to figure out either. I can get it to find the doc, but then it says there is an unsupported reference.

Could really use some help.

I only know one thing about .yaml. Its indentation format demands 2 spaces. Nothing else will work. You may simply have a formatting issue.

(Some pre-amble: I spend some while discussing this/trying things with Michael).

I believe the YAML works OK if exported as a separate document and used externally as a pandoc input parameter source.

What isn’t clear is where in this highly complex export things are going wrong. From what I’ve seen, I don’t think it is Tinderbox standard export but rather in the complex-plex-preview-without-export process.

I think it important to point out that—current Markdown support notwithstanding—‘Preview’ mode was introduced to allow the use to check HTML [sic] outpour without exporting. Markdown, pandoc, etc., come later in the piece.

To let the community help, I’d request @satikusala provide a ‘minimum viable example’ TBX doc (i.e. as little content as needed to prove all necessary elements) and then we will have a common frame of reference as this is definitely not a simple problem to resolve. It is also unclear that it is even a Tinderbox export problem at this stage, as opposed to optimistic expectations for what preview mode can handle. We need to consider the ROI of additional export complexity here, given that many users don’t use export.

Personally, I sue export and I think the idea proposed is neat, but I’m mindful of the wants/needs of the wider community of Tinderbox users. It may well be that it simply a case of exporting and ‘previewing’ externally, as we did up until v6.

This did the trick! Needed two space in front of the colons. I only had 1. Thanks!!! Which I knew this a week ago. ;-).

NOTE: to anyone reading this, I’ve corrected the above example. All is fine in the world now. This was driving me crazy.

1 Like

It is not, and never thought it was. Tinderbox is doing exactly that I’ve bene asking to do. I was just missing a space. Go figure.

You might try markdownify as discussed in jekyll - Including markdown inside yaml front-matter - Stack Overflow. It seems to address your question but I’m not sure how that might be shimmed into the app-embedded Markdown that you’re using.

Also python - Parsing YAML out of a Markdown file - Stack Overflow

1 Like

Pro tip: In Tinderbox, it’s often nice to save intermediate results in an attribute, so we can determine just what is going wrong inside a long and complex expression. The same technique can be helpful when testing a tool chain. Break your tool chain in half, and write the results to a file. Look at the file: is it right? If it looks right, pass it to the second half of your tool chain: is the output right?

In this case, you’d have gotten the YAML input you expected, but the expected YAML would not work. That would call your attention to figuring out exactly what YAML was doing.

Yes. I was doing that and you’re right. I was getting YAML errors. I just could not figure out why. The magic answer, two spaces and not one in the YAML file.

Michael,

As far as I know, Pandoc / Multimarkdown YAML doesn’t need two spaces before or after the colon — at least, it never has while I’ve used it and as far as I can see it’s not mentioned as a requirement in either manual. You need to indent the subsequent lines of multiple line blocks (e.g an author field with more than one author, but not the first line of metadata headers, where one space is fine after the colon (and you don’t need any before it).

According to the Multimarkdown syntax, however, it’s a good idea to put two spaces after the whole line (i.e. as a fake paragraph break) because otherwise more limited processors (e.g. bog standard markdown) may run the lines together.

While not required, I recommend using two spaces at the end of each line of metadata. This will improve the appearance of the metadata section if your document is processed by Markdown instead of MultiMarkdown. (Metadata)

As Tinderbox is using CommonMark, which is less sophisticated than either P or MM, then perhaps this may be what’s happening here?

(Apologies if I’m misunderstood what you’re trying to do here…)

Regards,

David.

Thanks for the note. I don’t know why, but two space after the colon works, one does not. Note, I’m not using Markdown or CommonMark in this case for HTMLPreview, but Pandoc.

Odd - a single space after the colon works fine in Pandoc for me (outside Tinderbox) — and there’s nothing in the Pandoc manual to suggest that more than one space is required. In fact, one of the examples they give of a metadata block has only one space (Pandoc - Pandoc User’s Guide)

---
title: The document title
author:
- name: Author One
  affiliation: University of Somewhere
- name: Author Two
  affiliation: University of Nowhere
...

It sounds like something’s going on within Tinderbox, but what, I’ve no idea :slight_smile: Does it work with two spaces at the end of the line as an alternative?

Regards

works great with two spaces between the colon and the word/command.

I know!

I was merely trying to help you sort out where the real problem is (there’s clearly something odd going on somewhere in your chain, because there’s no specified requirement for two spaces after the colon in either Pandoc or Multimarkdown’s use of YAML).

1 Like

We’ll, that is a relief as I was looking everywhere. Glad it is not there.

1 Like

“The number of spaces does not matter, but it must be consistent throughout the file. In our example, we used two spaces for readability.”

Nice references I found for us newbs to YAML:

https://docs.octoprint.org/en/master/configuration/yaml.html
https://www.commonwl.org/user_guide/yaml/

Tom

3 Likes