Removing blank lines from template.md (integration with DEVONthink)

Hi,

I’ve only just starting looking at Notenik, and I’m really impressed with it so far. – thanks! I think I’ve got to grips with the main features and I can see it would be really useful to use as a commonplace book.

I have what is probably a very simple question – sorry I’ve not found the answer anywhere yet…

Essentially, I want to index the commonplace book in DEVONthink 3, which means that any notes in the main folder must have acceptable markdown headers to be able to be previewed properly. (In other words, I don’t want to export — these have to be the ‘live’ notes.)

However, whenever I create new notes within Notenik, the .md documents are created with blank lines between the headers, which means that only the Title: field is accepted – all the other fields are not recognised as markdown headers by previewers, but as ordinary text.

The solution, of course, is to remove the blank lines between the headers, but when I try to amend the template.md file to do this, it’s ignored: files are still created with unnecessary blank lines.

I’ve looked through the help files, but can’t find anything to suggest what I’m doing wrong. I imagine I’m missing something embarassingly obvious, but how do I get round this problem, please?

Many thanks.

Hey, @brookter, welcome to the App, and to the Discourse community!

You might check out this page and see if it helps: https://notenik.app/knowledge-base/EPUB/html/existing-text-files.html.

Notenik will use its own format, if you let it, but if you point Notenik to an existing folder in one of these other formats, then Notenik will try to respect the existing format, even when creating new Notes. So you might want to copy your Collection, delete all the Notes but one, then edit that one Note into your desired format. Open the Collection in Notenik, then import your remaining Notes.

BTW, your instinct to remove the blank lines from the template file makes a lot of sense, but in this case, changing the template file won’t change how the Notes are formatted.

Let me know how this works for you. If it doesn’t work well for you then let me know. At some point I may want to allow this setting to be controlled through the Collection Prefs.

Thank you very much for the comprehensive reply!

I’ve sort of got this to work with a brand new simple collection template, with a couple of caveats.

Steps:

  1. Start a new collection with Basic Notes.

  2. Close Notenik and edit the starter note Notenik.md in BBEdit to be in YAML format.

  3. Reopen the collection in Notenik and create a new note.

  4. Import the rest of my files (which are in YAML header format). They all display fine.

So, the basic process works, but there are a couple of caveats:

  1. The new note created at 3. above is in standard Markdown header format, not in YAML. I.e. The new note lacks the --- enclosing the headers. (They still work with previews, though.)

  2. I can get this to work for a basic note collection, but when I tried it with a collection based on Commonplace with lookups, new notes are still produced in standard notenik format.

Screenshots:

Edited ‘base’ note:

New note:

So, this is encouraging, but I wonder if you have any tips for dealing with the two caveats?

Many thanks again!

Well, I’m at the point where I’m thinking that I need to give the user more explicit and granular control over the formatting of Notes and Collections. It may take me a couple of weeks to get there.

Well, thank you very much – I really appreciate your help (and the program, of course…)

Hey, I’ve got a new version that seems to be working. There’s an option on the Collection Prefs to change the Preferred File Format. Would you mind trying this out for me, and let me know how it goes? (Others are of course welcome to try it out and provide feedback as well.)
Notenik-10-5-1.zip (15.7 MB)

That seems to work very nicely!

Thank you very much for such a quick response – I think it’s going to be very useful, and I look forward to really exploring the program in depth!

Regards,

David

Hi,

Spoke too soon, I’m afraid - the newly created collection always crashes Notenik when it’s reopened.

I’ve sent you the crash logs via email.

Thanks!

I think I’ve found and fixed the problem. Here’s a new version to try.
Notenik-10-5-2.zip (15.7 MB)

I’ve had a chance to test this now - many thanks!

The crashing has now stopped when I create a new collection with the Basic and the standard Commonplace templates (I’m using the same script as in my previous email). I can create new notes, turn off the ‘explicit body’ tickbox, and this will now survive a restart of Notenik. So, as far as I can tell, this part is working properly.

However, trying to create a new ‘Commonplace with Lookups’ (here “Cpb5”) still crashes Notenik on reopening:

  1. Create New Collection → Icloud > ‘Cpb5’ > Collection with Lookups
  2. Cpb5 preferences → file extension .md → file format YAML (no other changes)
  3. Conversion works fine.
  4. Close Notenik → reopen → Notenik crashes immediately.
  5. Reopen Notenik → try to open ‘Cpb5’ manually → crashes immediately.

By the way, I’ve also tested (between steps 3 and 4) changing the file format of the sub-collections author-notes and author-works, and the result is the same: it’s impossible to open the cpb5 collection in Notenik.

So, it looks like I can now use the basic collection formats without problem, which is probably enough for me, but there’s still an issue with the more complicated ones.

Thanks again for your efforts!

David

Thanks again for the feedback! I found the bug causing the crash, and have fixed that, but I’m seeing a couple more things I want to tweak before posting another beta.

Brilliant! Thanks very much again…

David

OK. Here’s another beta. Let me know how this works for you. Thanks!
Notenik-10-5-4.zip (15.7 MB)

1 Like

Hi,

I’ve just tried this version out, and so far, all is good!

I.e. I ran the test which always crashed previous versions (create a new Commonplace Book with lookups collection, setting removing the ‘include body label’ field) and this time it opens properly afterwards and doesn’t crash the program.

I’ll obviously test it in more detail, but so far, it looks like that bug is quashed.

Many thanks for your help!

1 Like