From d45de3197467204d1e200ebb244aa810f0d5008c Mon Sep 17 00:00:00 2001 From: Lintao Date: Sun, 11 Dec 2022 22:05:39 +0800 Subject: [PATCH 1/2] format --- main.ts | 540 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 270 insertions(+), 270 deletions(-) diff --git a/main.ts b/main.ts index 7414ac1..06e6ae8 100644 --- a/main.ts +++ b/main.ts @@ -12,297 +12,297 @@ import { App, MarkdownView, Notice, Plugin, PluginSettingTab, Setting } from 'obsidian'; interface Table2CSVSettings { - exportPath: string; - baseFilename: string; - fileNumber: string; - sepChar: string; - quoteDataChar: string; - saveToClipboardToo: boolean; - removeCRLF: string; + exportPath: string; + baseFilename: string; + fileNumber: string; + sepChar: string; + quoteDataChar: string; + saveToClipboardToo: boolean; + removeCRLF: string; } const DEFAULT_SETTINGS: Table2CSVSettings = { - exportPath: './', - baseFilename: 'table-export', - fileNumber: '001', - sepChar: 'sepChar-semicolon', - quoteDataChar: 'quoteChar-noQuote', - saveToClipboardToo: false, - removeCRLF: 'removeCRLF-space' + exportPath: './', + baseFilename: 'table-export', + fileNumber: '001', + sepChar: 'sepChar-semicolon', + quoteDataChar: 'quoteChar-noQuote', + saveToClipboardToo: false, + removeCRLF: 'removeCRLF-space' } export default class Table2CSVPlugin extends Plugin { - settings: Table2CSVSettings; - - async onload() { - - await this.loadSettings(); - - this.addCommand({ - id: 'obsidian-table-to-csv-exporter', - name: 'Export table to CSV file', - checkCallback: (checking: boolean) => { - - const view = this.app.workspace.getActiveViewOfType(MarkdownView); - - if (view) { - if (!checking) { - // Here we can actually start with our work - const viewMode = view.getMode(); - if (viewMode=="preview") { - // Now convert the tables - const csvString = htmlToCSV(view.previewMode.containerEl, this.settings.sepChar, this.settings.quoteDataChar, this.settings.removeCRLF); - - // If csvString is not empty, create file: - if (csvString.length > 0) { - const filename = `${this.settings.baseFilename}-${this.settings.fileNumber}.csv`; - this.app.vault.create(filename, csvString) - .then( () => { - // increment the file number addition string - // first, convert the current string to a number: - let fn: number = +this.settings.fileNumber; - // then increment the number: - fn++; - // don't allow more that 999; restart with 001 in that case: - if (fn==1000) fn = 1; - // convert the number to a string again: - let newFileNumberString: string = fn + ""; - // add leading zeroes to the string: - while (newFileNumberString.length < 3) newFileNumberString = "0" + newFileNumberString; - this.settings.fileNumber = newFileNumberString; - if (this.settings.saveToClipboardToo) { - navigator.clipboard - .writeText(csvString) - .then(() => { - new Notice(`The file ${filename} was successfully created in your vault. The contents was also copied to the clipboard.`); - }) - .catch((err) => { - new Notice('There was an error with copying the contents to the clipboard.'); - }); - - } else { - new Notice(`The file ${filename} was successfully created in your vault.`) - } - }) - - .catch( (error) => { - const errorMessage = `Error: ${error.message}`; - new Notice(errorMessage); - }) - } - else { - new Notice(`No table was found. No CSV file was written.`); - } - - } - else { - new Notice('This command only works on panes in reading mode! – No CSV files were written.'); - } - } - - return true; + settings: Table2CSVSettings; + + async onload() { + + await this.loadSettings(); + + this.addCommand({ + id: 'obsidian-table-to-csv-exporter', + name: 'Export table to CSV file', + checkCallback: (checking: boolean) => { + + const view = this.app.workspace.getActiveViewOfType(MarkdownView); + + if (view) { + if (!checking) { + // Here we can actually start with our work + const viewMode = view.getMode(); + if (viewMode == "preview") { + // Now convert the tables + const csvString = htmlToCSV(view.previewMode.containerEl, this.settings.sepChar, this.settings.quoteDataChar, this.settings.removeCRLF); + + // If csvString is not empty, create file: + if (csvString.length > 0) { + const filename = `${this.settings.baseFilename}-${this.settings.fileNumber}.csv`; + this.app.vault.create(filename, csvString) + .then(() => { + // increment the file number addition string + // first, convert the current string to a number: + let fn: number = +this.settings.fileNumber; + // then increment the number: + fn++; + // don't allow more that 999; restart with 001 in that case: + if (fn == 1000) fn = 1; + // convert the number to a string again: + let newFileNumberString: string = fn + ""; + // add leading zeroes to the string: + while (newFileNumberString.length < 3) newFileNumberString = "0" + newFileNumberString; + this.settings.fileNumber = newFileNumberString; + if (this.settings.saveToClipboardToo) { + navigator.clipboard + .writeText(csvString) + .then(() => { + new Notice(`The file ${filename} was successfully created in your vault. The contents was also copied to the clipboard.`); + }) + .catch((err) => { + new Notice('There was an error with copying the contents to the clipboard.'); + }); + + } else { + new Notice(`The file ${filename} was successfully created in your vault.`) + } + }) + + .catch((error) => { + const errorMessage = `Error: ${error.message}`; + new Notice(errorMessage); + }) + } + else { + new Notice(`No table was found. No CSV file was written.`); + } + + } + else { + new Notice('This command only works on panes in reading mode! – No CSV files were written.'); } + } - return false; - } - }); + return true; + } + + return false; + } + }); - // This adds a settings tab so the user can configure various aspects of the plugin - this.addSettingTab(new Table2CSVSettingTab(this.app, this)); + // This adds a settings tab so the user can configure various aspects of the plugin + this.addSettingTab(new Table2CSVSettingTab(this.app, this)); - console.log(`Table to CSV plugin: Version ${this.manifest.version} loaded.`); - } + console.log(`Table to CSV plugin: Version ${this.manifest.version} loaded.`); + } - onunload() { - } + onunload() { + } - async loadSettings() { - this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); - } + async loadSettings() { + this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()); + } - async saveSettings() { - await this.saveData(this.settings); - } + async saveSettings() { + await this.saveData(this.settings); + } } function htmlToCSV(html: HTMLElement, sepMode: string, quoteChar: string, removeCRLF: string) { - var data = []; - var table = html.querySelector("table"); - //console.log(`htmlToCSV::table: ${table}`); - - if (table) { - var rows = table.rows; - //console.log(`htmlToCSV::rows: ${rows}`); - for (var i = 0; i < rows.length; i++) { - var row = [], cols = rows[i].querySelectorAll("td, th"); - - for (var j = 0; j < cols.length; j++) { - var cellContent = (cols[j] as HTMLElement).innerText; - - // handle the optional replacement of CR/LF characters: - if (removeCRLF=='removeCRLF-clear') { - cellContent = cellContent.replace(/(\r\n|\n|\r)/gm, ""); - } else if (removeCRLF=='removeCRLF-space') { - cellContent = cellContent.replace(/(\r\n|\n|\r)/gm, " "); - } else if (removeCRLF=='removeCRLF-string1') { - cellContent = cellContent.replace(/(\r\n|\n|\r)/gm, "[CR]"); - } + var data = []; + var table = html.querySelector("table"); + //console.log(`htmlToCSV::table: ${table}`); - // handle the quoting of data cells: - // for now it's just the hard-coded character " - if (quoteChar=='quoteChar-doubleQuotes') { - cellContent = '"' + cellContent + '"'; - } else if (quoteChar=='quoteChar-singleQuotes') { - cellContent = "'" + cellContent + "'"; - } - row.push(cellContent); - } - - var sepChar = ';'; - switch(sepMode) { - case 'sepChar-semicolon': - sepChar = ';'; - break; - case 'sepChar-comma': - sepChar = ','; - break; - case 'sepChar-tab': - sepChar = '\t'; - break; - case 'sepChar-pipe': - sepChar = '|'; - break; - case 'sepChar-tilde': - sepChar = '~'; - break; - case 'sepChar-caret': - sepChar = '^'; - break; - case 'sepChar-colon': - sepChar = ':'; - break; - } - data.push(row.join(sepChar)); + if (table) { + var rows = table.rows; + //console.log(`htmlToCSV::rows: ${rows}`); + for (var i = 0; i < rows.length; i++) { + var row = [], cols = rows[i].querySelectorAll("td, th"); + + for (var j = 0; j < cols.length; j++) { + var cellContent = (cols[j] as HTMLElement).innerText; + + // handle the optional replacement of CR/LF characters: + if (removeCRLF == 'removeCRLF-clear') { + cellContent = cellContent.replace(/(\r\n|\n|\r)/gm, ""); + } else if (removeCRLF == 'removeCRLF-space') { + cellContent = cellContent.replace(/(\r\n|\n|\r)/gm, " "); + } else if (removeCRLF == 'removeCRLF-string1') { + cellContent = cellContent.replace(/(\r\n|\n|\r)/gm, "[CR]"); + } + + // handle the quoting of data cells: + // for now it's just the hard-coded character " + if (quoteChar == 'quoteChar-doubleQuotes') { + cellContent = '"' + cellContent + '"'; + } else if (quoteChar == 'quoteChar-singleQuotes') { + cellContent = "'" + cellContent + "'"; + } + row.push(cellContent); + } + + var sepChar = ';'; + switch (sepMode) { + case 'sepChar-semicolon': + sepChar = ';'; + break; + case 'sepChar-comma': + sepChar = ','; + break; + case 'sepChar-tab': + sepChar = '\t'; + break; + case 'sepChar-pipe': + sepChar = '|'; + break; + case 'sepChar-tilde': + sepChar = '~'; + break; + case 'sepChar-caret': + sepChar = '^'; + break; + case 'sepChar-colon': + sepChar = ':'; + break; } - } - //console.log(`htmlToCSV::data.length: ${data.length}`); - if (data.length > 0) - return data.join("\n"); - else - return ""; + data.push(row.join(sepChar)); + } + } + //console.log(`htmlToCSV::data.length: ${data.length}`); + if (data.length > 0) + return data.join("\n"); + else + return ""; } class Table2CSVSettingTab extends PluginSettingTab { - plugin: Table2CSVPlugin; - - constructor(app: App, plugin: Table2CSVPlugin) { - super(app, plugin); - this.plugin = plugin; - } - - display(): void { - const {containerEl} = this; - - containerEl.empty(); - - containerEl.createEl('h2', {text: 'Settings for the Table to CSV Plugin.'}); - containerEl.createEl('p', {text: 'NOTE: Currently, the exported CSV files are saved inside your vault main folder.'}); - - // Being able to set a path for the exports will be a future addition - // ------------------------------------------------------------------ - // new Setting(containerEl) - // .setName('CSV file export path') - // .setDesc('Enter the path where the exported CSV file should be saved. If no path is set the CSV file will be saved into your vault folder.') - // .addText(text => text - // .setPlaceholder('') - // .setValue(this.plugin.settings.exportPath) - // .onChange(async (value) => { - // console.log('path: ' + value); - // this.plugin.settings.exportPath = value; - // await this.plugin.saveSettings(); - // })); - - new Setting(containerEl) - .setName('CSV file base filename') - .setDesc('Enter the base filename. The "File Number addendum" gets added after that and finally .csv') - .addText(text => text - .setPlaceholder(' { - //console.log('base filename: ' + value); - this.plugin.settings.baseFilename = value; - await this.plugin.saveSettings(); - })); - - new Setting(containerEl) - .setName('File Number addendum') - .setDesc('This number gets added to the base filename and incremented after each export. Normally, you shouldn\'t need to edit this.') - .addText(text => text - .setPlaceholder('') - .setValue(this.plugin.settings.fileNumber) - .onChange(async (value) => { - //console.log('fileNumber: ' + value); - this.plugin.settings.fileNumber = value; - await this.plugin.saveSettings(); - })); - - new Setting(containerEl) - .setName('Data fields separation character/string') - .setDesc('This character will be put between each cell\'s data. Defaults to a semicolon.') - .addDropdown(dropdown => dropdown - .addOption('sepChar-semicolon', '; (semicolon)') - .addOption('sepChar-comma', ', (comma)') - .addOption('sepChar-tab', '\\t (tab)') - .addOption('sepChar-pipe', '| (pipe)') - .addOption('sepChar-tilde', '~ (tilde)') - .addOption('sepChar-caret', '^ (caret)') - .addOption('sepChar-colon', ': (colon)') - .setValue(this.plugin.settings.sepChar) - .onChange(async (value) => { - //console.log('sepChar: ' + value); - this.plugin.settings.sepChar = value; - await this.plugin.saveSettings(); - })); - - new Setting(containerEl) - .setName('Quote data') - .setDesc('Do you want quotation marks around each cell\'s data?') - .addDropdown( dropdown => dropdown - .addOption('quoteChar-noQuote', 'Don\'t quote data') - .addOption('quoteChar-doubleQuotes', 'Quote data with double quote character (")') - .addOption('quoteChar-singleQuotes', 'Quote data with single quote character (\')') - .setValue(this.plugin.settings.quoteDataChar) - .onChange(async (value) => { - //console.log('quote data toggle: ' + value); - this.plugin.settings.quoteDataChar = value; - await this.plugin.saveSettings(); - })); - - new Setting(containerEl) - .setName('Handling of CR/LF in data') - .setDesc('Choose how to handle the occurance of return and linefeed characters in data cells.') - .addDropdown( dropdown => dropdown - .addOption('removeCRLF-clear', 'Remove all CR & LF characters') - .addOption('removeCRLF-space', 'Replace all CR & LF characters with one space') - .addOption('removeCRLF-string1', 'Replace all CR & LF characters with string [CR]') - .setValue(this.plugin.settings.removeCRLF) - .onChange(async (value) => { - this.plugin.settings.removeCRLF = value; - await this.plugin.saveSettings(); - })) - - new Setting(containerEl) - .setName('Copy to clipboard, too') - .setDesc('Do you want to copy the contents of the CSV file to the system clipboard, too?') - .addToggle( toggle => toggle - .setValue(this.plugin.settings.saveToClipboardToo) - .onChange(async (value) => { - //console.log('save to clipboard, too: ' + value); - this.plugin.settings.saveToClipboardToo = value; - await this.plugin.saveSettings(); - })); - - } + plugin: Table2CSVPlugin; + + constructor(app: App, plugin: Table2CSVPlugin) { + super(app, plugin); + this.plugin = plugin; + } + + display(): void { + const { containerEl } = this; + + containerEl.empty(); + + containerEl.createEl('h2', { text: 'Settings for the Table to CSV Plugin.' }); + containerEl.createEl('p', { text: 'NOTE: Currently, the exported CSV files are saved inside your vault main folder.' }); + + // Being able to set a path for the exports will be a future addition + // ------------------------------------------------------------------ + // new Setting(containerEl) + // .setName('CSV file export path') + // .setDesc('Enter the path where the exported CSV file should be saved. If no path is set the CSV file will be saved into your vault folder.') + // .addText(text => text + // .setPlaceholder('') + // .setValue(this.plugin.settings.exportPath) + // .onChange(async (value) => { + // console.log('path: ' + value); + // this.plugin.settings.exportPath = value; + // await this.plugin.saveSettings(); + // })); + + new Setting(containerEl) + .setName('CSV file base filename') + .setDesc('Enter the base filename. The "File Number addendum" gets added after that and finally .csv') + .addText(text => text + .setPlaceholder(' { + //console.log('base filename: ' + value); + this.plugin.settings.baseFilename = value; + await this.plugin.saveSettings(); + })); + + new Setting(containerEl) + .setName('File Number addendum') + .setDesc('This number gets added to the base filename and incremented after each export. Normally, you shouldn\'t need to edit this.') + .addText(text => text + .setPlaceholder('') + .setValue(this.plugin.settings.fileNumber) + .onChange(async (value) => { + //console.log('fileNumber: ' + value); + this.plugin.settings.fileNumber = value; + await this.plugin.saveSettings(); + })); + + new Setting(containerEl) + .setName('Data fields separation character/string') + .setDesc('This character will be put between each cell\'s data. Defaults to a semicolon.') + .addDropdown(dropdown => dropdown + .addOption('sepChar-semicolon', '; (semicolon)') + .addOption('sepChar-comma', ', (comma)') + .addOption('sepChar-tab', '\\t (tab)') + .addOption('sepChar-pipe', '| (pipe)') + .addOption('sepChar-tilde', '~ (tilde)') + .addOption('sepChar-caret', '^ (caret)') + .addOption('sepChar-colon', ': (colon)') + .setValue(this.plugin.settings.sepChar) + .onChange(async (value) => { + //console.log('sepChar: ' + value); + this.plugin.settings.sepChar = value; + await this.plugin.saveSettings(); + })); + + new Setting(containerEl) + .setName('Quote data') + .setDesc('Do you want quotation marks around each cell\'s data?') + .addDropdown(dropdown => dropdown + .addOption('quoteChar-noQuote', 'Don\'t quote data') + .addOption('quoteChar-doubleQuotes', 'Quote data with double quote character (")') + .addOption('quoteChar-singleQuotes', 'Quote data with single quote character (\')') + .setValue(this.plugin.settings.quoteDataChar) + .onChange(async (value) => { + //console.log('quote data toggle: ' + value); + this.plugin.settings.quoteDataChar = value; + await this.plugin.saveSettings(); + })); + + new Setting(containerEl) + .setName('Handling of CR/LF in data') + .setDesc('Choose how to handle the occurance of return and linefeed characters in data cells.') + .addDropdown(dropdown => dropdown + .addOption('removeCRLF-clear', 'Remove all CR & LF characters') + .addOption('removeCRLF-space', 'Replace all CR & LF characters with one space') + .addOption('removeCRLF-string1', 'Replace all CR & LF characters with string [CR]') + .setValue(this.plugin.settings.removeCRLF) + .onChange(async (value) => { + this.plugin.settings.removeCRLF = value; + await this.plugin.saveSettings(); + })) + + new Setting(containerEl) + .setName('Copy to clipboard, too') + .setDesc('Do you want to copy the contents of the CSV file to the system clipboard, too?') + .addToggle(toggle => toggle + .setValue(this.plugin.settings.saveToClipboardToo) + .onChange(async (value) => { + //console.log('save to clipboard, too: ' + value); + this.plugin.settings.saveToClipboardToo = value; + await this.plugin.saveSettings(); + })); + + } } From 9afa2f216af6fc8b9dee5ebe47bfd700bffe1ced Mon Sep 17 00:00:00 2001 From: Lintao Date: Sun, 11 Dec 2022 22:39:02 +0800 Subject: [PATCH 2/2] add save to markdown function --- main.ts | 103 ++++++++++++++++++++++++++++++++++++++++++++++ package-lock.json | 37 +++++++++++++++-- package.json | 6 ++- 3 files changed, 141 insertions(+), 5 deletions(-) diff --git a/main.ts b/main.ts index 06e6ae8..f967647 100644 --- a/main.ts +++ b/main.ts @@ -10,6 +10,7 @@ // ---------------------------------------------------------------------------------------- import { App, MarkdownView, Notice, Plugin, PluginSettingTab, Setting } from 'obsidian'; +import { v4 as uuidv4 } from 'uuid'; interface Table2CSVSettings { exportPath: string; @@ -38,6 +39,36 @@ export default class Table2CSVPlugin extends Plugin { await this.loadSettings(); + this.addCommand({ + id: 'export-to-markdown', + name: "Export table to markdown", + checkCallback: (checking: boolean) => { + + console.log("markdown command") + const view = this.app.workspace.getActiveViewOfType(MarkdownView); + + if (view) { + if (!checking) { + const rows = htmlToRows(view.previewMode.containerEl, this.settings.quoteDataChar, this.settings.removeCRLF) + console.log("rows:") + console.log(rows) + const markdown = generateMarkdown(rows) + console.log("Markdown: ") + console.log(markdown) + writeToFile(`${uuidv4()}.md`, markdown) + } + } + } + }) + + this.addCommand({ + id: 'obsidian-table-to-csv-exporter', + name: 'Export table to Markdown2', + checkCallback: (checking: boolean) => { + console.log("print test") + } + }); + this.addCommand({ id: 'obsidian-table-to-csv-exporter', name: 'Export table to CSV file', @@ -126,6 +157,78 @@ export default class Table2CSVPlugin extends Plugin { } } +function writeToFile(filename: string, content: string) { + this.app.vault.create(filename, content) + + new Notice(`The file ${filename} was successfully created in your vault.`) +} + +function generateMarkdown(rows: string[][]) { + const head = arrayDataToMarkdownRow(rows[0]) + const seperator = generateSeperator(rows[0].length) + const contents = generateContent(rows.slice(1)) + return head + seperator + contents +} + +function generateContent(rows: string[][]) { + const contents = [] + for (let index = 0; index < rows.length; index++) { + const row = rows[index]; + + contents.push(arrayDataToMarkdownRow(row)) + } + return contents.join("") +} + +function generateSeperator(colNumber: number) { + const a = [] + for (let index = 0; index < colNumber; index++) { + a.push("---") + } + return arrayDataToMarkdownRow(a) +} + + +function arrayDataToMarkdownRow(rowData: string[]) { + return "|" + rowData.join("|") + '|\n' +} + +function htmlToRows(html: HTMLElement, quoteChar: string, removeCRLF: string) { + var data = []; + var table = html.querySelector("table"); + + if (table) { + var rows = table.rows; + for (var i = 0; i < rows.length; i++) { + var row = [], cols = rows[i].querySelectorAll("td, th"); + + for (var j = 0; j < cols.length; j++) { + var cellContent = (cols[j] as HTMLElement).innerText; + + // handle the optional replacement of CR/LF characters: + if (removeCRLF == 'removeCRLF-clear') { + cellContent = cellContent.replace(/(\r\n|\n|\r)/gm, ""); + } else if (removeCRLF == 'removeCRLF-space') { + cellContent = cellContent.replace(/(\r\n|\n|\r)/gm, " "); + } else if (removeCRLF == 'removeCRLF-string1') { + cellContent = cellContent.replace(/(\r\n|\n|\r)/gm, "[CR]"); + } + + // handle the quoting of data cells: + // for now it's just the hard-coded character " + if (quoteChar == 'quoteChar-doubleQuotes') { + cellContent = '"' + cellContent + '"'; + } else if (quoteChar == 'quoteChar-singleQuotes') { + cellContent = "'" + cellContent + "'"; + } + row.push(cellContent); + } + + data.push(row); + } + } + return data; +} function htmlToCSV(html: HTMLElement, sepMode: string, quoteChar: string, removeCRLF: string) { var data = []; diff --git a/package-lock.json b/package-lock.json index 7c9e27d..2e6a354 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,19 @@ { - "name": "obsidian-sample-plugin", - "version": "1.0.1", + "name": "obsidian-table-to-csv-exporter", + "version": "0.1.5", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "obsidian-sample-plugin", - "version": "1.0.1", + "name": "obsidian-table-to-csv-exporter", + "version": "0.1.5", "license": "MIT", + "dependencies": { + "uuid": "^9.0.0" + }, "devDependencies": { "@types/node": "^16.11.6", + "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.2.0", "@typescript-eslint/parser": "^5.2.0", "builtin-modules": "^3.2.0", @@ -170,6 +174,12 @@ "@types/estree": "*" } }, + "node_modules/@types/uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-kr90f+ERiQtKWMz5rP32ltJ/BtULDI5RVO0uavn1HQUOwjx0R1h0rnDYNL0CepF1zL5bSY6FISAfd9tOdDhU5Q==", + "dev": true + }, "node_modules/@typescript-eslint/eslint-plugin": { "version": "5.26.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.26.0.tgz", @@ -1860,6 +1870,14 @@ "punycode": "^2.1.0" } }, + "node_modules/uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/v8-compile-cache": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", @@ -2050,6 +2068,12 @@ "@types/estree": "*" } }, + "@types/uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-kr90f+ERiQtKWMz5rP32ltJ/BtULDI5RVO0uavn1HQUOwjx0R1h0rnDYNL0CepF1zL5bSY6FISAfd9tOdDhU5Q==", + "dev": true + }, "@typescript-eslint/eslint-plugin": { "version": "5.26.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.26.0.tgz", @@ -3228,6 +3252,11 @@ "punycode": "^2.1.0" } }, + "uuid": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", + "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" + }, "v8-compile-cache": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", diff --git a/package.json b/package.json index 8dea282..498f549 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "obsidian-table-to-csv-exporter", - "version": "0.1.4", + "version": "0.1.5", "description": "This plugin allows to export tables in a preview pane to be exported to CSV files.", "main": "main.js", "scripts": { @@ -13,6 +13,7 @@ "license": "MIT", "devDependencies": { "@types/node": "^16.11.6", + "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.2.0", "@typescript-eslint/parser": "^5.2.0", "builtin-modules": "^3.2.0", @@ -20,5 +21,8 @@ "obsidian": "latest", "tslib": "2.3.1", "typescript": "4.4.4" + }, + "dependencies": { + "uuid": "^9.0.0" } }