YAML front matter reading (while importing) and parsing (when exporting)

Is your feature request related to a problem? Please describe.

This feature request is related to upcoming releases, regarding import and export of .md files.

Describe the solution you’d like

Importing

My notes have a front matter like this:

---
date: 2021-11-16T09:35:47+01:00
updated: 2021-11-18T12:55:48+01:00
tags: geek info example
description: |
  Notes about moving out of <a href='https://github.com/xplosionmind' target='_blank' title='my GitHub profile'>GitHub</a> and setting up a self-hosted <a href='https://gitea.com' target='_blank' title='Gitea'>Gitea</a> instance.
aliases: Switch to Gitea, Quit GitHub, Ditch GitHub
image: https://upload.wikimedia.org/wikipedia/commons/b/bb/Gitea_Logo.svg
---

It would be awesome if at import time the user could choose what front matter entry to associate to a value, e.g. prompting: «You have entry image with value https://upload.wikimedia.org/wikipedia/commons/b/bb/Gitea_Logo.svg. What do you want to do with it?», and the user could select the option to get image URLs and setting them as the image for the object in Anytype.
The same should happen with all of the other entries of the front matter. Of course, in my case I would need to import a ton of Markdown files at once, so it would be ideal to select in batch which YAML entries to associate to object properties.

Exporting

When exporting Markdown files, not only the content should be printed, but metadata, too. Again, this should be done by parsing a YAML front matter containing all of the info of the object.

Describe alternatives you’ve considered

Once the .md import feature is enabled, a user would be forced to manually add metadata.

Additional context

8 Likes

Perhaps within the relation itself there could be an option to set this relation as YAML? Or per page you can have a setting to show relations as YAML on the top of the page.

Then when exporting to .md these pages/relations are exported as shown in your example.

Though, this might be very complicated?

Love the idea though, makes perfect sense since Anytype is all about owning your own thoughts and ideas and this will make Anytype way less restricting if you ever needed to export it!

4 Likes

This would be a nice solution.

My perspective is that the more content, information and metadata stays in plain text, the better it is.

I would really appreciate if all of the relevant information could easily be retrieved in the Anytype directory by running a simple good old find.

1 Like

The front matter is actually meta data about the content, and Anytype’s way of handling meta data to a page is through relations. So the proper solution in my opinion is for the user to create a type specific to their notes. So for your example, either the user should have created a type with the relations date - datetime, update - datetime, tags - tag, description - text, aliases - text, image - url and the importer should ask the user for the type during import to import the page. So importing similar notes would then create new pages if that type and populate the relations with values from the front matter and the body of the page from the content of the note. Another option is for the importer to create a type based on the front matter, but that is much more complex than the user creating it. This would then enable the user to create a set for that type and use the front matter to sort or filter through them

This is something that should be given as an option to the user to export the relation or not for any type of exports not limited to markdown. So having such option would then export the page’s relation in accordance with the exported type

Might be hard to maintain everything in plain text and offer the same flexibility as now. But one could certainly create a find alternative specific to anytype which has the same interface as that of find, once the local APIs are out :smile:

1 Like

Is your feature request related to a problem?
This is not a problem, simply something useful.

Describe the solution you’d like
That the relations in a page that has been exported would have the possibility to be exported via YAML formatting, either in a separate file or at the top separated by two — lines. Ideally this would also work for import, but this request is mainly for Markdown export.

Ideally, you should even be able to decide which relations to export, or even be able to define how you would like the various relations are formatted in YAML (like, single tag, tags in brackets, sub-tags…), but the title, created, modified, and tags relations should always be present.

Give us a real world use case for this feature
Example of output:

---
tags: [university, italian, second_semester]
created: 05-10-2020
modified: 10-12-2022
professor: Aida Catalanotti
title: Giacomo Leopardi
---

This would help importing Anytype notes into Obsidian for example. At the moment you need to do all this manually.

3 Likes

I would love to see this implemented. Those relations are key to linking information, and having them included in the markdown file in some way would make Anytype even more futureproof.

It is very itchy that Markdown importing is available, but front matter is not read at all, and it is parsed as text in the note…

1 Like

It’s a must have for people coming from obsidian or any other markdown editor that makes use of frontmatter. It would save a ton of work if properties could be imported and exported as a frontmatter metadata. My small database containing a little over hundred files but contains a lot of metadata and it would take me way too long to move them into anytype.

4 Likes

Just came across this topic looking for a way to export the relations inside the markdown files. I’ve been testing Anytype since the beginning of alpha, but I still use Notion as my main tool for notes and task management. However, I want to move all my data somewhere that is more “future-proof”. That is, if I just want to export everything I have and save the plain text files, how would that go? Notion is terrible at this.

I love Anytype for many reasons, such as E2EE and being offline-first (I also think the objects and sets approach is brilliant). However, the markdown export just drops a lot of important information, since the relations are just ignored. If that could be added it would be a game changer for me!

4 Likes

I came here for this. Lack of metadata in .md exports is the only reason I’m not more invested in Anytype.

5 Likes

I built a system of thousands of notes that I wanted to bring back into Obsidian and then found out it wouldn’t work at all.

2 Likes

I just did an export of a note and realized that none of the relations show up at all. This is crazy.

I want to move from Notion, but right now Notion still exports better to Markdown which is crazy. AnyType definitely needs this. If I can’t export the relations to markdown, then why add relations at all?

3 Likes

I was initially excited by markdown import/export, but then did a test before starting to use the product for my workflow. Very disappointed to not be able to include relation information in markdown exports.

Export is useful to prevent lock in, encourages embracing the platform. But without relation data being exported, there is no effective export for the information created while using the features that bring incremental value above other products.

Please add a front matter or YAML or any sensible export/import of this information for markdown and the product becomes a no-brainer to embrace, recommend, and invest time into.

1 Like

For me its also a must have to export everything, not just the content. Metadata must also be included in the export.

In my case I have a Movie Database and my Metadata say when I watched a movie, rating etc. - when I export to markdown only the movie title is in the file …
At Notion everything is included when I export to CSV.