@wicked belfry @next siren So I figured out what's causing this.
This line, inside processHTML, is causing it: https://github.com/streetwriters/notesnook-importer/blob/9fc832da67935d6b2df738674e4a09b3ebeabe10/packages/core/src/providers/html/index.ts#L96
Here the title is being extracted from the html. So far so good if you want that, but on the next line the html itself is being altered, by removing the "titleElement".
const titleElement = findOne(
(e) => ["title", "h1", "h2"].includes(e.tagName),
document.childNodes,
true
);
if (titleElement) removeElement(titleElement);
What makes this a bug, is that when we are importing markdown, after we get the html from the markdown, processHTML is called first and only after that the title is being decided upon based on settings or whether frontmatter has been found.
Now if one of those two would decide the title should be taken from somewhere else than the titleElement in the html provider (i.e. from the file name or from the frontmatter), the html has already been altered and we have lost the header level 1 or 2. This is what is happening in my case.
I think the easiest solution, is to remove line 100 that alters the HTML itself. This way you are sure no information is ever lost. This also requires no changes to the rest of the app.
What do you guys think?