notes

The notes setting lets you customize how Zotero notes are processed for Roam import

Settings

Default behavior

By default, the extension will call the built-in parser function zoteroRoam.utils.formatItemNotes(...), give it as input a nested Array structure (use: 'text') where each string element will be a Roam block (elements obtained by splitting the note on split_char: '\n'). This replicates the default behavior of v0.5.

However, if you are using the zoteroRoam.formatting.getChildren utility in your custom metadata formatting function, know that it will now use the settings above to format your notes - instead of always using the extension's built-in. So, if you change these settings, the output will be modified accordingly without you having to rewrite your function's code ๐ŸŽ‰

Examples

Changing how Roam blocks are delimited

Simply change split_char to be whatever character you'd like.

// Splitting notes into blocks based on paragraph tags
zoteroRoam_settings = {
    // dataRequests: {...}, (the usual contents of your settings object)
    notes: {
        split_char: "</p>"
    }
}

Using a custom parser function

Write your function, with the syntax window.myParser = function(notes){...}, and supply its name as the value for the func argument. Set the use parameter as needed :

// Assuming you've declared your function somewhere
// window.myParser = function(notes){...}


// If you're writing a parser that uses the raw data :
zoteroRoam_settings = {
    // dataRequests: {...}, (the usual contents of your settings object)
    notes: {
        use: "raw",
        func: "myParser"
    }
}

// If you're writing a parser that cleans up the HTML only,
// and want to keep the default split_char :
zoteroRoam_settings = {
    // dataRequests: {...}, (the usual contents of your settings object)
    notes: {
        func: "myParser"
    }
}

If you decide to write your own parsing function, know that you'll have to clean all the HTML markup yourself. You can use the utility function zoteroRoam.utils.parseNoteBlock(item){...} which accepts a block (a string) as input, and returns its cleaned version.

Last updated