Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keywords YAML does not work in 3.0 beta 6 #4498

Open
2 of 5 tasks
BabakFarshchian opened this issue Jul 16, 2023 · 13 comments · May be fixed by #4517
Open
2 of 5 tasks

Keywords YAML does not work in 3.0 beta 6 #4498

BabakFarshchian opened this issue Jul 16, 2023 · 13 comments · May be fixed by #4517
Labels
bug A bug that affects the functionality of Zettlr.

Comments

@BabakFarshchian
Copy link

Description

It seems Zettlr 3 beta 6 ignores all the keywords in the YAML keyword/tag list. They are no clickable anymore, and they don't result in the buildup of the related files tab.

Reproducing

1- Create a file with a YAML front end.
2- Add keywords to the YAML front end.
3- Observe the behavior described above :-)

Zettlr Version

Beta (if applicable)

Specify version

3.0 beta 6

Installation Method

From the Website or GitHub

Your Platform

  • Windows
  • macOS
  • Linux

Architecture

  • Intel 64bit
  • ARM 64bit

Operating System Version

Windows 11

Additional Information

If I move the keywords out of the YAML front end and write it with hashtag it works. The problem is that my 500+ notes all use YAML keywords :-(

@BabakFarshchian BabakFarshchian added the bug A bug that affects the functionality of Zettlr. label Jul 16, 2023
@nathanlesage
Copy link
Member

Same as the last bug; I just added a few keywords, and they show up properly:

image

I have the feeling that I may have really bodged beta.6, apologies for that 😄

@BabakFarshchian
Copy link
Author

OK. My problem is that you cannot click on the keyword in the YAML header and start a search. I suspect this is the same #3887 that maybe is not solved?

Uninstalled everything and installed from nightly build. Same error. Closed the workspace and restarted and open workspace again. Same thing. Any information I can provide?

@UFOMelkor
Copy link
Contributor

Correct me if I'm wrong @nathanlesage, but I would the problem is, that the frontmatter parser does not create a custom element for the tags / keywords, and therefore they currently cannot be rendered to trigger a search.

@nathanlesage
Copy link
Member

I already understood what the issue is, and yes, it's the same as a previous one. It reappeared due to the CodeMirror migration.

@UFOMelkor It actually does create custom tags (even though they're ugly), the issue is simply that I have not had the time and motivation to re-implement clickable YAML keywords. If you want to do so, feel free to have a look at the syntax tree of a file with YAML frontmatter, there are tons of stuff that can be extracted and used for that.

@UFOMelkor
Copy link
Contributor

Perhaps you could give me a hint about how to add the functionality.

The click on ZknTags is done in the MarkdownEditor. So this was the first place where I thought to add the click on FrontMatter tags. But here I could only look for node CodeText (a TreeNode) and I have not found a way to look for the inner element (resolveInner(pos, 0|-1|1) did not work, neither does enter).

Another position where I have looked was a custom renderer. It looked more promising, as I could look for the inner elements, but here I have no access to the editorInstance to emit an event.

@nathanlesage
Copy link
Member

A custom renderer is basically the right way to go. What we want is a renderer that is not toggle-able (i.e. just an extension that gets injected in the editor extension sets for Markdown mode) that looks for I think YAML values (you'd have to check) that fulfill not just the criterion that they are of a certain node type (because that is generic) but also that it is preceded by one of the keywords (tags or keywords), and then just add a decorator to those values that triggers a search one Command/CTRL Click.

@UFOMelkor
Copy link
Contributor

that triggers a search one Command/CTRL Click.

This is the question I have. How do I trigger a search from an event listener that is configured in a renderer? I do not have access to the editor instance.

@nathanlesage
Copy link
Member

There may be a better way than a custom renderer: I just saw that on line 292 in the editor's index.ts there are domEventListeners, I believe we can do something like that where it looks if the user cmd/ctrl clicks a valid Tag in the frontmatter.

@BabakFarshchian
Copy link
Author

This is still an issue with my install. I delayed using version 3 because all my keywords are in YAML (wrong strategy?). In 3.02 Zettlr at least parses the keywords and I can search for keywords in the search window. However clicking the keyword in YAML is still not possible. (It is possible to click the #keyword in the text so maybe I should start moving my keywords to the hashtag format).

@nathanlesage
Copy link
Member

Don't move your keywords to the hashtag format, I myself keep most of it in the frontmatter as well, it's just that I simply don't have an inch of time at the moment to fix it, and there are good ways of working around it. Please be patient.

@BabakFarshchian
Copy link
Author

Don't move your keywords to the hashtag format, I myself keep most of it in the frontmatter as well, it's just that I simply don't have an inch of time at the moment to fix it, and there are good ways of working around it. Please be patient.

No problem Hendrik. I will be patient. I have a workaround and the tags are thankfully loaded correctly ;-)

@BabakFarshchian
Copy link
Author

Hi folks. I just installed the latest beta 3. The issue of YAML tags seems to be worsened. The tags are still not clickable. In addition, I used to be able to type # and the first letters in a tag, browse in a pop-up list of tags, and click enter to add a tag. Zettlr does not anymore allow me to do this (I can still do this if I write # outside the YAML header). This now makes adding tags in YAML very tedious because now I have to find the tags manually by browsing my tag list first, and manually add the tags to YAML.

The change log says a new YAML parser is being used now. Does this mean that we will see more YAML improvements in the near future, or should we move away from YAML tags and use hashtags outside YAML headers instead?

As always, thanks a lot for the great work!

@nathanlesage
Copy link
Member

The change log says a new YAML parser is being used now. Does this mean that we will see more YAML improvements in the near future, or should we move away from YAML tags and use hashtags outside YAML headers instead?

The former — the new parser now gives us more leverage over doing stuff with the frontmatter. However, implementing keyword handling etc. is a bit finicky and will take a bit of time. But that's on the roadmap ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug that affects the functionality of Zettlr.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants