Skip to content

Evernote: Optionally import titles and dates as frontmatter values#488

Open
zarino wants to merge 2 commits intoobsidianmd:masterfrom
zarino:master
Open

Evernote: Optionally import titles and dates as frontmatter values#488
zarino wants to merge 2 commits intoobsidianmd:masterfrom
zarino:master

Conversation

@zarino
Copy link
Copy Markdown

@zarino zarino commented Jan 5, 2026

Follow-up to #467, which also fixes #409.

Two changes:

  • Optionally imports the original note title, and creation and modification dates, from ENEX files, as frontmatter values on imported notes.
  • Also YAML-escapes those values (well, all frontmatter values, in ENEX imports, apart from tag lists) to avoid special characters (eg: a title string containing an unescaped : ) from invalidating a note’s frontmatter.
screenshot

I used this myself, along with obsidian-front-matter-title and notebook-navigator, to smooth my transition from Evernote. I figured it may be useful to others in a similar situation.

The code around Yarle template-handling is pretty complex, so I’ve done my best to work out how to integrate the YAML escaping. But if there’s a different way you’d like me to re-attempt it, let me know.

I guess, also, there’s nothing about these features which are especially Evernote-specific. Users importing from other sources may equally want their YAML frontmatter to be escaped, and even for note titles and dates to be imported as frontmatter values. If that’s the case, I’m happy to generalise this code to work for all importers, but I may need some pointers from you on where best to make these changes.

Happy also to re-submit these commits as two separate PRs, as I realise they’re technically solving two separate issues.

zarino added 2 commits January 5, 2026 08:43
Adds three new options to the import settings for ENEX files:

- Include original title in frontmatter
- Include created date in frontmatter
- Include updated date in frontmatter

The storage of custom titles in note frontmatter is useful when
importing notes from Evernote, since an Evernote note title can contain
special characters which are not allowed in filenames and will therefore
be sanitised during the import to Obsidian. If you want to retain your
note titles exactly as they were in Evernote, you need to store the
titles in the frontmatter, and then use plugins like [1] or [2] to
display and update them.

Some Obsidian users also prefer to store creation and modification dates
in the frontmatter of their notes because they host their Obsidian vault
on filesystems with inconsistent date handling, or because their chosen
synchronisation systems tend to overzealously reset filesystem dates
even when the actual note content hasn’t been changed. These two new
options allow these users to import the creation/modification dates from
their ENEX export file, to the frontmatter of their notes (where they
can then be used by plugins like [2] and [3]), making for a smoother
migration to Obsidian.

[1]: https://github.com/snezhig/obsidian-front-matter-title
[2]: https://github.com/johansan/notebook-navigator
[3]: https://github.com/alangrainger/obsidian-frontmatter-modified-date
Blindly adding strings to the YAML frontmatter is a bad idea, as they
might contain characters (such as the ": " sequence) which will result
in malformed YAML.

`applyTemplateOnBlock` and `getTemplateBlockSettings` now escape YAML
frontmatter values by default, but with an option to `skipYamlEscaping`,
which is set to true for the content and tag list blocks (where we trust
any YAML special characters have been intentionally included).
Copy link
Copy Markdown
Contributor

@tgrosinger tgrosinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for these changes, it looks great. Just a couple comments.

Could you please also remove the ctime/mtime frontmatter properties and leave just the title property? I just did a little testing and it seems like the Evernote importer is properly setting the ctime/mtime on the file itself, so for now I'm requesting that this not be duplicated.

Thank you!

skipYamlEscaping,
}: TemplateBlockSettings): string => {
if (value && check()) {
const finalValue = skipYamlEscaping ? value : escapeYamlValue(value);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding this new flag, I think it would be simpler and easier to follow if value passed into this function is already escaped if it needs to be. So for the two templates where escaping is enabled now, it needs to instead escape noteData.content or noteData.title before calling getTemplateBlockSettings.

import { TemplateBlockSettings } from '../template-settings';

export const getTemplateBlockSettings = (text: string, check: Function, T: any, value?: string): TemplateBlockSettings => {
export const getTemplateBlockSettings = (text: string, check: Function, T: any, value?: string, skipYamlEscaping?: boolean): TemplateBlockSettings => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove skipYamlEscaping. See related comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Evernote title, created, and updated metadata not imported

2 participants