Import MD file with frontmatter

What is the difference between importing "MD: Markdown (file)" and "MD: Markdown + Front Matter (file)"? I imported a file twice with different settings, but they appeared exactly the same.

I have this front matter, but the tags were not recognized.

title: Alienation
uuid: 1ca96b3c-eb67-11ed-8d92-462f72f1314f
version: 2
created: '2023-05-05T09:01:54-04:00'

  • capitalism
  • alienation

That might be a bug.

Looking at Joplin's source code, it seems that it should support the following frontmatter syntax:

- a
- b
- c

Additionally, there seems to be a test related to tags in markdown with frontmatter that uses the following markdown document:

That's too bad. I opened the MD file in a text editor. It's a very simple file without any complications. I'm using 2.13.15 on Windows 11. Hope to see some test results from other people.

Is your frontmatter ending with three - and an empty line?


Could you upload a example file (81 Bytes)

This file can't be imported corrected. However, I created a md file with the test note above and the frontmatter was actually recognized by Joplin. I can't find any difference between the two files.

It looks like that file starts with a UTF-8 BOM (Byte Order Mark).

This is what a hexdump of the file looks like:

$ xxd ./
00000000: efbb bf2d 2d2d 0a74 6974 6c65 3a20 416c  ...---.title: Al
00000010: 6965 6e61 7469 6f6e 0a74 6167 733a 0a20  ienation.tags:. 
00000020: 202d 2063 6170 6974 616c 6973 6d0a 2020   - capitalism.  
00000030: 2d20 616c 6965 6e61 7469 6f6e 0a2d 2d2d  - alienation.---
00000040: 0a0a 5468 6973 2069 7320 6120 6e6f 7465  ..This is a note
00000050: 2e                                       .

Notice that the first three bytes are ef bb bf and that the --- starts at byte 4.

As can be seen in the source code, Joplin expects the first characters of a YAML frontmatter note to be ---, and it seems that the BOM is breaking that assumption.

Edit: I've created a GitHub issue.

1 Like

Many thanks! I guess I cannot edit the file to remove the Mark with an ordinary text editor such as Windows Notepad?

This StackOverflow post suggests that Notepad can remove the byte order mark by selecting "save as", then choosing "UTF-8" in the encoding dropdown (instead of "UTF-8 with BOM").

Thank you so much. It worked! Since in the future these will be many md files exported from another app, I would hope Joplin can also accept "UTF-8 with BOM." Otherwise I'll have to find a batch conversion solution.

This work-in-progress commit should fix the issue in Joplin — however, I would like to do some refactoring before creating a pull request.

1 Like