Skip to content
This repository has been archived by the owner on Aug 30, 2023. It is now read-only.

Improve YAML front matter support #255

Open
brainchild0 opened this issue Feb 19, 2019 · 10 comments
Open

Improve YAML front matter support #255

brainchild0 opened this issue Feb 19, 2019 · 10 comments

Comments

@brainchild0
Copy link

I was unsure whether opening a new issue would be warranted, compared to commenting on #142, but since #142 is represented as resolved and included in a release, I feel a new issue is appropriate.

I have included a verbatim copy of a sample document, and a screen capture of the HTML preview.

I think you would agree that the YAML header is not ignored, and I wonder whether I am misunderstanding the functionality represented in release 0.7.0. The first line is --- , which I read is the condition that triggers processing as the ignored header.

For the record, I fully support interoperability with documents using this format, including the #222 suggestion of processing the fields. Displaying and generating documents that show a formatted title, subtitle, author, date, and so on, would be very nice.

Abricotine version: 0.7.0
OS type: Linux Mint
OS version: 19.1

---
title: A Title
---

# First Heading

Lorem lipsum.

screenshot from 2019-02-19 12-08-37

@brrd
Copy link
Owner

brrd commented Feb 19, 2019

YAML Headers is not ignored but recognized in the editor since last release. You are right, the app should also:

  • ignore it in TOC
  • ignore it when exporting with kramed

I didin't try but I think it should work better when using Pandoc export though.

@brrd brrd changed the title yaml header not ignored Improve YAML front matter support Feb 19, 2019
@brainchild0
Copy link
Author

What is the currently supported behavior?

I am confused about what I should expect, and how I can or cannot use the YAML header.

@brrd
Copy link
Owner

brrd commented Feb 20, 2019

This: https://codemirror.net/mode/yaml-frontmatter/
CodeMirror markdown-mode is not used anymore on YAML front matter.

@brainchild0
Copy link
Author

The linked document describes internal parsing. From a user standpoint, of display, interaction, and generation, I remain confused about what to expect.

@brrd
Copy link
Owner

brrd commented Feb 20, 2019

From a user standpoint, of display, interaction, and generation, I remain confused about what to expect.

Editor does not apply markdown styles anymore to YAML header. That's all (but I don't really see what more can be expected, except maybe fixing the issue with table of contents displayed in pane).

generation

Abricotine is an editor, not a generator. Default HTML preview/export is provided by kramed, which does it in a very simple way. Since latest release you can also set custom tasks in order to run Pandoc or any other command-line tool to export documents, which is useful when you want an advanced control on the export (as you do).

If the app behavior is not clear enough for you then my advice would be that you switch to another markdown editor. You can find many very robust alternatives on the Internet.

@brainchild0
Copy link
Author

If the app behavior is not clear enough for you then my advice would be that you switch to another markdown editor. You can find many very robust alternatives on the Internet.

Well, you're right, if I wanted to switch to another editor, then I could do so. But if you're open to suggestions, where applicable, and bug reports, where applicable, then I might be able to help. But making the distinction between a feature request and bug report depends on knowing what behavior is specified. For me, the natural interpretation of "Ignore YAML-Header" (#142) is that the header is filtered out from the stream before the stream is written to the output generators. If you intended otherwise, then I accept your intention, but my suggestion for Abricotine, irrespective of which editor I use, would be to avoid writing particular data to a generator if it processes that data differently from how the user intended.

Ultimately, the discussion is not an argument over what is meant by "ignore", though that distinction was the original source of confusion. The discussion is in fact not any kind of argument. It's a simple observation that users will have a better experience adding YAML headers if doing so does not create unwanted results in the output.

Even if the suggestion does not ultimately help you, I would still thank you for reading it.

@brrd
Copy link
Owner

brrd commented Mar 18, 2019

For me, the natural interpretation of "Ignore YAML-Header" (#142) is that the header is filtered out from the stream before the stream is written to the output generators.

Many processors support YAML headers and actually do something useful with it, so I don't think it's a good idea to filter it out when exporting. Philosophy behind Tasks is to emphasize the distinction between edition and export. Abricotine is responsible for the editing so IMHO it should not intend to filter data before it is send to the processor (except with non standard data that is specific to the application).

So IMO, YAML header should be:

  • ignored in TOC (left pane)
  • ignored when exporting with kramed (and HTML preview in browser, which is basically the same)
  • kept in exported data

@brainchild0
Copy link
Author

brainchild0 commented Mar 18, 2019

Your earlier comment made the observation that some processors do not recognize the YAML header as a region in which to suspend Markdown processing. This was the reason you gave for the preview not displaying as one would want it to display, as I showed in the original report.

Everything you stated is accurate, as I understand.

My suggestion was intended to express sending YAML headers to processors that understand how to use them, and filtering out those headers for invoking processors that do not know how to process the YAML as metadata.

I am not sure whether or not we are agreeing, because of the ambiguity of the word "ignore" in this context.

@chris2fr
Copy link

I don't think the YML ignoring quite works on Windows...

@brrd
Copy link
Owner

brrd commented May 21, 2020

@chris2fr Once again (#142): please explain what you mean by "YAML ignoring". What do you expect and what happens actually? We can't guess if you don't describe your issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants