diff --git a/package-lock.json b/package-lock.json index 571509b..56a2f87 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11556,11 +11556,11 @@ } }, "node_modules/highlight.js": { - "version": "10.7.3", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", - "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==", + "version": "11.10.0", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.10.0.tgz", + "integrity": "sha512-SYVnVFswQER+zu1laSya563s+F8VDGt7o35d4utbamowvUNLLMovFqwCLSocpZTz3MgaSRA1IbqRWZv97dtErQ==", "engines": { - "node": "*" + "node": ">=12.0.0" } }, "node_modules/hosted-git-info": { @@ -14679,6 +14679,14 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/lowlight/node_modules/highlight.js": { + "version": "10.7.3", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", + "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==", + "engines": { + "node": "*" + } + }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -14836,14 +14844,6 @@ "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==" }, - "node_modules/md-to-pdf/node_modules/highlight.js": { - "version": "11.10.0", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.10.0.tgz", - "integrity": "sha512-SYVnVFswQER+zu1laSya563s+F8VDGt7o35d4utbamowvUNLLMovFqwCLSocpZTz3MgaSRA1IbqRWZv97dtErQ==", - "engines": { - "node": ">=12.0.0" - } - }, "node_modules/md-to-pdf/node_modules/marked": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", @@ -18327,6 +18327,14 @@ "react": ">= 0.14.0" } }, + "node_modules/react-syntax-highlighter/node_modules/highlight.js": { + "version": "10.7.3", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz", + "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==", + "engines": { + "node": "*" + } + }, "node_modules/react-test-renderer": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-test-renderer/-/react-test-renderer-18.2.0.tgz", diff --git a/package.json b/package.json index 8ac9d7f..006d1e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "description": "A simple markdown editor", - "version": "1.2.0-alpha.0", + "version": "1.2.0-alpha.1", "keywords": [ "markdown", "editor" @@ -236,7 +236,11 @@ "output": "release/build" }, "extraResources": [ - "./assets/**" + "./assets/**", + { + "from": "node_modules/highlight.js", + "to": "node_modules/highlight.js" + } ], "publish": { "provider": "github", diff --git a/release/app/package-lock.json b/release/app/package-lock.json index 8dbced8..527b271 100644 --- a/release/app/package-lock.json +++ b/release/app/package-lock.json @@ -1,12 +1,12 @@ { "name": "elementary", - "version": "1.2.0-alpha.0", + "version": "1.2.0-alpha.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "elementary", - "version": "1.2.0-alpha.0", + "version": "1.2.0-alpha.1", "hasInstallScript": true, "license": "MIT" } diff --git a/release/app/package.json b/release/app/package.json index 79c9adb..1a05cd5 100644 --- a/release/app/package.json +++ b/release/app/package.json @@ -1,6 +1,6 @@ { "name": "elementary", - "version": "1.2.0-alpha.0", + "version": "1.2.0-alpha.1", "description": "A simple markdown editor", "license": "MIT", "author": { diff --git a/roadmap.md b/roadmap.md index b2ec15e..683b6fb 100644 --- a/roadmap.md +++ b/roadmap.md @@ -6,9 +6,6 @@ The following features are ordered according to their importance and ease of imp - Review code highlight themes in preview - Fix syntax highlight in embedded html -- Add upper/lower case shortcuts a -- Add line duplicate shortcut -- Add bold filename on open recent ## Long term diff --git a/src/main/main.ts b/src/main/main.ts index 9327b54..6848a31 100644 --- a/src/main/main.ts +++ b/src/main/main.ts @@ -184,6 +184,7 @@ ipcMain.handle('exportToPDF', async (_, mdPath: string) => { const pdf = await mdToPdf({ path: mdPath }, { document_title: 'Elementary', css: exportCSS, + stylesheet: [], pdf_options: { printBackground: true, margin: { @@ -194,13 +195,17 @@ ipcMain.handle('exportToPDF', async (_, mdPath: string) => { } }, body_class: ['elementary'], - marked_extensions: [markedFootnote({ description: '' })] + marked_extensions: [markedFootnote({ description: '' })], + launch_options: { + args: ['--no-sandbox', '--disable-setuid-sandbox'] + } }); if (!pdf) return 1; fs.writeFileSync(pdfPath, pdf.content); return pdfPath; } catch (e) { + console.log(e); return 1; } }); @@ -233,3 +238,6 @@ ipcMain.handle('getVersionInfo', async () => { return { firstTime, update }; }); + +// @ts-ignore +console.log(eval("require.resolve('highlight.js')")); diff --git a/src/renderer/texts/info.md b/src/renderer/texts/info.md index f3d632c..cb25d78 100644 --- a/src/renderer/texts/info.md +++ b/src/renderer/texts/info.md @@ -18,8 +18,6 @@ I loved Typora's editing experience, but it has since become a paid app... On th Then, I learnt that VS Code's core editor, Monaco, was open-source. That's when the idea of adapting Monaco to fit my needs came to be. The core of Elementary is based on Monaco and should provide a reliable and bug-free experience. I did, however, change all of the editor's styles for aesthetic's sake, and built the logic that makes this a standalone app. Elementary uses electron and react, put together by the electron-react-boilerplate. -I plan to have an integrated PDF exporter soon and would like to implement a spell-checker as soon as possible. - I hope you enjoy Elementary! bogosorter diff --git a/src/renderer/texts/pdfExportGuide.md b/src/renderer/texts/pdfExportGuide.md index 4abaa94..d0e2af0 100644 --- a/src/renderer/texts/pdfExportGuide.md +++ b/src/renderer/texts/pdfExportGuide.md @@ -1,66 +1,44 @@ # PDF export guide - [Export configuration](#export-configuration) + - [Document title](#document-title) + - [PDF options](#pdf-options) + - [Custom header and footer](#custom-header-and-footer) - [Including CSS](#including-css) - [Additional tips](#additional-tips) +- [Export errors](#export-errors) + + ## Export configuration -Elementary's PDF exporter will work out of the box, but you'll likely want to configure it a little further. PDF configuration is done through some metadata at the top of the document in [YAML](https://en.wikipedia.org/wiki/YAML). +Please note that Elementary's PDF exporter will work out of the box. All of the steps described here are optional. PDF configuration is done through some metadata at the top of the document in [YAML](https://en.wikipedia.org/wiki/YAML). To start a YAML block, insert this at the top of your document: -```txt +```markdown --- # Content goes here --- ``` -These are the available options: + +### Document title ```yaml --- +document_title: The Complete History of Bogosort +--- +``` -document_title: Title - -# There are four ways to add CSS to the document: -# - Inline CSS in the initial YAML (will only be rendered on exporting) -# - CSS files in initial YAML (will only be rendered on exporting) -# - Inline CSS using the