diff --git a/README.md b/README.md index 147004dc..42281ffc 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ![logo](screens/yarle-logo.png) ![Last Commit](https://img.shields.io/github/last-commit/akosbalasko/yarle?style=for-the-badge) -![Version](https://img.shields.io/badge/version-4.0.6-blue?style=for-the-badge) +![Version](https://img.shields.io/badge/version-4.0.7-blue?style=for-the-badge) [![Documentation](https://img.shields.io/badge/documentation-yes-brightgreen?style=for-the-badge)](https://github.com/akosbalasko/yarle#readme) [![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green?style=for-the-badge)](https://github.com/akosbalasko/yarle/graphs/commit-activity) [![License: MIT](https://img.shields.io/github/license/akosbalasko/yarle?style=for-the-badge)](https://github.com/akosbalasko/yarle/blob/master/LICENSE) @@ -38,13 +38,13 @@ Yarle is the ultimate converter of Evernote notes to Markdown. ## Binaries: -[Windows](https://github.com/akosbalasko/yarle/releases/download/v4.0.6/yarle-evernote-to-md-4.0.6.Setup.exe) +[Windows](https://github.com/akosbalasko/yarle/releases/download/v4.0.7/yarle-evernote-to-md-4.0.7.Setup.exe) -[Linux](https://github.com/akosbalasko/yarle/releases/download/v4.0.6/yarle-evernote-to-md-4.0.6-1.x86_64.rpm) +[Linux](https://github.com/akosbalasko/yarle/releases/download/v4.0.7/yarle-evernote-to-md-4.0.7-1.x86_64.rpm) -[Debian](https://github.com/akosbalasko/yarle/releases/download/v4.0.6/yarle-evernote-to-md_4.0.6_amd64.deb) +[Debian](https://github.com/akosbalasko/yarle/releases/download/v4.0.7/yarle-evernote-to-md_4.0.7_amd64.deb) -[Mac](https://github.com/akosbalasko/yarle/releases/download/v4.0.6/yarle-evernote-to-md-darwin-x64-4.0.6.zip) +[Mac](https://github.com/akosbalasko/yarle/releases/download/v4.0.7/yarle-evernote-to-md-darwin-x64-4.0.7.zip) diff --git a/config.json b/config.json index 5844f7e3..d9373bcc 100644 --- a/config.json +++ b/config.json @@ -14,7 +14,8 @@ "skipWebClips": false, "skipTags": false, "useHashTags": true, - "outputFormat": "StandardMD", + "outputFormat": "ObsidianMD", "skipEnexFileNameFromOutputPath": false, - "keepOriginalAmountOfNewlines": false + "keepOriginalAmountOfNewlines": false, + "pathSeparator": "/" } \ No newline at end of file diff --git a/package.json b/package.json index a076fd1d..8d7e1cd7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yarle-evernote-to-md", - "version": "4.0.6", + "version": "4.0.7", "description": "Yet Another Rope Ladder from Evernote", "keywords": [ "evernote", diff --git a/screens/yarle-logo_3.png b/screens/yarle-logo_3.png new file mode 100644 index 00000000..e9a983df Binary files /dev/null and b/screens/yarle-logo_3.png differ diff --git a/src/YarleOptions.ts b/src/YarleOptions.ts index 897eb11d..2df01004 100644 --- a/src/YarleOptions.ts +++ b/src/YarleOptions.ts @@ -29,4 +29,5 @@ export interface YarleOptions { keepImageSize?: OutputFormat; keepOriginalAmountOfNewlines?: boolean; addExtensionToInternalLinks?: boolean; + pathSeparator?: string; } diff --git a/src/process-resources.ts b/src/process-resources.ts index bf32c01d..73871fd3 100644 --- a/src/process-resources.ts +++ b/src/process-resources.ts @@ -6,6 +6,8 @@ import * as path from 'path'; import { ResourceHashItem } from './models/ResourceHash'; import * as utils from './utils'; +import { yarleOptions } from './yarle'; + export const processResources = (note: any): string => { let resourceHashes: any = {}; let updatedContent = cloneDeep(note.content); @@ -34,7 +36,7 @@ export const processResources = (note: any): string => { }; const addMediaReference = (content: string, resourceHashes: any, hash: any, workDir: string): string => { - const src = `${workDir}${path.sep}${resourceHashes[hash].fileName.replace(/ /g, '\ ')}`; + const src = `${workDir}${yarleOptions.pathSeparator}${resourceHashes[hash].fileName.replace(/ /g, '\ ')}`; let updatedContent = cloneDeep(content); const replace = `]*)hash="${hash}".([^>]*)>`; diff --git a/src/utils/folder-utils.ts b/src/utils/folder-utils.ts index 8b64c0aa..8f61731a 100644 --- a/src/utils/folder-utils.ts +++ b/src/utils/folder-utils.ts @@ -29,7 +29,7 @@ export const getHtmlFilePath = (note: any): string => { export const getHtmlFileLink = (note: any): string => { const filePath = getHtmlFilePath(note); - return `.${filePath.slice(paths.resourcePath.lastIndexOf(path.sep))}`; + return `.${filePath.slice(paths.resourcePath.lastIndexOf(yarleOptions.pathSeparator))}`; }; const clearDistDir = (dstPath: string): void => { @@ -40,11 +40,11 @@ const clearDistDir = (dstPath: string): void => { }; export const getRelativeResourceDir = (note: any): string => { - return yarleOptions.haveEnexLevelResources ? `.${path.sep}_resources` : `.${path.sep}_resources${path.sep}${getResourceDir(paths.mdPath, note)}.resources`; + return yarleOptions.haveEnexLevelResources ? `.${yarleOptions.pathSeparator}_resources` : `.${yarleOptions.pathSeparator}_resources${yarleOptions.pathSeparator}${getResourceDir(paths.mdPath, note)}.resources`; }; export const getAbsoluteResourceDir = (note: any): string => { - return yarleOptions.haveEnexLevelResources ? paths.resourcePath : `${paths.resourcePath}${path.sep}${getResourceDir(paths.mdPath, note)}.resources`; + return yarleOptions.haveEnexLevelResources ? paths.resourcePath : `${paths.resourcePath}${yarleOptions.pathSeparator}${getResourceDir(paths.mdPath, note)}.resources`; }; const resourceDirClears = new Map(); @@ -74,17 +74,17 @@ export const clearMdNotesDistDir = (): void => { export const setPaths = (): void => { loggerInfo('setting paths'); - const enexFolder = yarleOptions.enexSource.split(path.sep); + const enexFolder = yarleOptions.enexSource.split(yarleOptions.pathSeparator); const enexFile = (enexFolder.length >= 1 ? enexFolder[enexFolder.length - 1] : enexFolder[0]).split('.')[0]; const outputDir = path.isAbsolute(yarleOptions.outputDir) ? yarleOptions.outputDir - : `${process.cwd()}${path.sep}${yarleOptions.outputDir}`; + : `${process.cwd()}${yarleOptions.pathSeparator}${yarleOptions.outputDir}`; - paths.mdPath = `${outputDir}${path.sep}notes${path.sep}`; - paths.resourcePath = `${outputDir}${path.sep}notes${path.sep}_resources`; + paths.mdPath = `${outputDir}${yarleOptions.pathSeparator}notes${yarleOptions.pathSeparator}`; + paths.resourcePath = `${outputDir}${yarleOptions.pathSeparator}notes${yarleOptions.pathSeparator}_resources`; if (!yarleOptions.skipEnexFileNameFromOutputPath) { paths.mdPath = `${paths.mdPath}${enexFile}`; - paths.resourcePath = `${outputDir}${path.sep}notes${path.sep}${enexFile}${path.sep}_resources`; + paths.resourcePath = `${outputDir}${yarleOptions.pathSeparator}notes${yarleOptions.pathSeparator}${enexFile}${yarleOptions.pathSeparator}_resources`; } fsExtra.mkdirsSync(paths.mdPath); fsExtra.mkdirsSync(paths.resourcePath); diff --git a/src/yarle.ts b/src/yarle.ts index 047392b2..d1b783dd 100644 --- a/src/yarle.ts +++ b/src/yarle.ts @@ -27,6 +27,7 @@ export const defaultYarleOptions: YarleOptions = { }, outputFormat: OutputFormat.StandardMD, urlEncodeFileNamesAndLinks: false, + pathSeparator: '/' }; export let yarleOptions: YarleOptions = { ...defaultYarleOptions }; @@ -34,6 +35,13 @@ export let yarleOptions: YarleOptions = { ...defaultYarleOptions }; const setOptions = (options: YarleOptions): void => { yarleOptions = { ...defaultYarleOptions, ...options }; + if (options.nestedTags){ + yarleOptions.nestedTags = { + separatorInEN: options.nestedTags.separatorInEN || defaultYarleOptions.nestedTags.separatorInEN, + replaceSpaceWith: options.nestedTags.replaceSpaceWith || defaultYarleOptions.nestedTags.replaceSpaceWith, + replaceSeparatorWith: options.nestedTags.replaceSeparatorWith || defaultYarleOptions.nestedTags.replaceSeparatorWith + } + }; let template = (yarleOptions.templateFile) ? fs.readFileSync(yarleOptions.templateFile, 'utf-8'): defaultTemplate; template = yarleOptions.currentTemplate ? yarleOptions.currentTemplate : template;