farling42 / obsidian-import-json

Plug-in for Obsidian.md which will create Notes from JSON files
MIT License
85 stars 5 forks source link

Is there a way to import todos in Markdown format? #50

Closed zenminimalist closed 1 year ago

zenminimalist commented 1 year ago

I'm currently trying to import cells that contain a markdown checkmark about whether there are notes on this book or so.

This is what the cells contain: CleanShot 2023-08-19 at 21 59 43@2x

Part of my template file looks like this:

#### Available Notes

`=this.Printed`
`=this.BookHighlightsandNotes`
`=this.BookSummary`

The result I get though is this:

-
-
-

I would like the result to have the Obsidian style checkmarks. Any way to accomplish that?

farling42 commented 1 year ago

What is the source file? Is it CSV or JSON? Is it possible for me to see the source data file, so that I can see how the string is encoded.

zenminimalist commented 1 year ago

Sorry, forgot to mention that. It imported via CSV. Here's the sample file I tested: Sample.csv

farling42 commented 1 year ago

Your template should be using

#### Available Notes

{{Printed}}
{{BookHighlightsandNotes}}
{{BookSummary}}

You need the column title from the CSV in {{...}} in order for the field to be read from the CSV data.

You might need to manually specify the separator as ";" (if the column names aren't detected properly)

zenminimalist commented 1 year ago

Thanks, that did it!

I wasn't using the curly brackets for the body of the template file. I followed a guide on YT and tried to replicate it for my temple.

So just to make sure, the template for the YAML section looks something like this:

---
TitleOriginal: {{TitleOriginal}}
PrimaryAuthor: {{PrimaryAuthor}}
Publication: {{Publication}}
etc...
---

And the part of teh template for the my body section looks something like this:

## Book Details & Meta Data

#### Available Notes

`=this.Printed`
`=this.BookHighlight

#### Book Snapshot

**Author:** `=this.PrimaryAuthor`
**Date:** `=this.Date`
**Pages:** `=this.Pages`
**Languages:** `=this.Languages`
**Original Languages:** `=this.OriginalLanguages`  

#### Book Snapshot

**Author:** `=this.PrimaryAuthor`
**Date:** `=this.Date`
**Pages:** `=this.Pages`
**Languages:** `=this.Languages`
**Original Languages:** `=this.OriginalLanguages`  

#### Book Details  

**ISBN10:** `=this.ISBN10`
**ISBN13:** `=this.ISBN13`
**ASIN:** `=this.ASIN`
**Amazon Link:** `=this.AMZLink`
**LibraryThing Link:** `=this.LTLink`
**List Price:** $`=this.ListPrice`  

That's correct so far, right? Or do I use the {{curly brackets}} for the whole template?

farling42 commented 1 year ago

Curly brackets are required around the column name where you want that column's string to appear.

All the "=this.XXX" looks like some syntax that the Dataviews plugin uses. It has nothing to do with the CSV importer module.

zenminimalist commented 1 year ago

That did it! Thanks again!

And that removed the =this.XXX in the edit view too. I even managed to add callouts in the template file and worked flawlessly. The more I use your plugin the move I love it!