Export Without Strange Names

It’s possible to export all files without strange names on the file title?

Strange names situation print

I will not write too much, to not overload you guys, but TBH this is a must-have for me.

Ty for your attention!

You have to write a script that uses a tool called ‘live-export’:

You can control almost everything, including filenames like so:

const sub = await liveExport.start({
  live: false,
  bookId: '<YOUR_BOOK_ID>',
  preProcessNote: ({ note, frontmatter, tags }) => {
    frontmatter.title = note.title
    // Convert note title to kebab case (eg. "kebab-case-note-title")
    frontmatter.slug = toKebabCase(note.title)
    frontmatter.tags = tags.map(t => t.name)
  pathForNote: ({ /* note, */ frontmatter }) => {
    // export only if it's public
    if (frontmatter.public) {
      return `./<PATH_TO_EXPORT_NOTES>/${frontmatter.slug}.md`
    } else return false
  urlForNote: ({ frontmatter }) => {
    if (frontmatter.public) {
      return `/<URL_TO_LINK_NOTES>/${frontmatter.slug}`
    } else return false
  pathForFile: ({ mdastNode, /* note, file, */ extension, frontmatter }) => {
    if (frontmatter.slug && mdastNode.alt) {
      const fn = `${frontmatter.slug}_${toKebabCase(
      const res = {
        filePath: `./<PATH_TO_EXPORT_IMAGES>/${fn}`,
        url: `./<URL_TO_LINK_IMAGES>/${fn}`
      // If the `alt` attribute of the image is 'thumbnail', use it as a hero image
      if (mdastNode.alt === 'thumbnail') {
        frontmatter.heroImage = res.filePath
      return res
    } else return false
  postProcessNote: ({ md }) => {
    // Remove the thumbnail image from the Markdown body
    const md2 = md.replace(/\!\[thumbnail\]\(.*\)\n/, '')
    return md2
1 Like

Very interesting! Thanks for the help. I actually saw that you have a video tutorial for this tool as well.

Personally, I don’t have that much experience with programming or scripts; the most I ever did was to take a brief look into SlackBuilds scripts to build Slackware packages when I was a Linux user. I’m more of a law student who likes to write notes in Markdown and pretends to learn Python in the future.

So, I did a little research and found this plugin called “Plain Text Backups”. It seems like it does a backup inside the traditional backup folder, but with plain text everywhere. It does not work in all notes, and I would never activate it on a computer that it’s not mine, but it seems very handy to use at home.

1 Like

Yeah, live-export is kind of advanced.

You mean plain_text_backups?
That’s one of the plugins @Ryan_McQuen created! Great that it solved your need.


Hey @anon85935573 glad the plugin was helpful! What do you mean by ‘It does not work in all notes’?

1 Like

I was analyzing this issue here, and I noticed that the content of notes with “:” on the title is blank.

For example, I have a file called “Current: Physical Exercises” in which I take notes on the current exercises I’m doing and how to enhance them. This note is blank in the backup folder.

I also have problems with random folder creation with notes with dates on the title. In that regard, I usually give this title to therapy notes, for example: “On Good Humor and Family - 22/09/2023”. In this case, the plugin seems to absorb the day date to the title “Good Humor and Family - 22”, then create a month folder “09” and finally give the note a year title “2023”.

Moreover, the plugin seems not to work with images yet, despite I feel like it’s not exactly a bug; it’s more like a missing feature.

Ah yes, I would like to add image support. What operating system are you on? Some characters are invalid on certain systems, so using different names may ‘fix’ the file export.

Specifically, I would avoid colons and slashes in names.