Skip to content

Add export note to PDF (#243)#652

Merged
Rokt33r merged 5 commits intoBoostIO:masterfrom
Komediruzecki:feature/add-export-note-to-pdf
Nov 21, 2020
Merged

Add export note to PDF (#243)#652
Rokt33r merged 5 commits intoBoostIO:masterfrom
Komediruzecki:feature/add-export-note-to-pdf

Conversation

@Komediruzecki
Copy link
Copy Markdown
Contributor

@Komediruzecki Komediruzecki commented Oct 24, 2020

Add export note to PDF (3e6abd4)
Add export note markdown to PDF in note detail
Add render_md_to_pdf.html file for rendering markdown to HTML first
Add logic for printing to PDF via webContents.printToPdf
Refactor note title sanitization to shared function
Add support for global css style in exports.ts
Add support for wrapping long lines when exporting pre and code through markdown and codemirror sections

Refactor export note to PDF (9f80d9a)
Refactor code to not use any static HTML file (and thus no javascript, safer for XSS)
Refactor code to be more readable
Reorder menu items for md, html and pdf
Refactor includeFrontMatter fetching
Add support for mathml rendering in PDF export (fix escapes)
Add support for proper header and footer in PDF

  • Include front matter option in Markdown - Export section to get header and footer

Test:
In electron Linux App
In electron Linux App production version (appImage)

Todo:

  • Refactor paths from "node_modules" to actual paths in production
  • See how to test this better for all app versions (Linux, Windows, Web, Mac, Mobile)
  • See if we can remove dependency to previewStyle (removing first N lines etc)
  • See if we can add nicer menu item icons (instead of text) for exporting
  • See if we can add some PDF export options (pageSize: A3, A4, landscape: mode, ...)

IssueHunt Summary

Referenced issues

This pull request has been submitted to:


@Flexo013 Flexo013 added the awaiting review ❇️ Pull request is awaiting a review. label Oct 24, 2020
@Komediruzecki Komediruzecki force-pushed the feature/add-export-note-to-pdf branch 3 times, most recently from 5b3b516 to bb3340a Compare November 3, 2020 19:59
@Komediruzecki Komediruzecki force-pushed the feature/add-export-note-to-pdf branch 9 times, most recently from 9d6bb52 to 5c18f5b Compare November 10, 2020 19:09
@Komediruzecki Komediruzecki force-pushed the feature/add-export-note-to-pdf branch 4 times, most recently from 736ffc8 to 9f80d9a Compare November 19, 2020 06:23
Komediruzecki and others added 3 commits November 21, 2020 16:33
Add export note markdown to PDF in note page toolbar
Add render_md_to_pdf.html file for rendering markdown to HTML first
Add logic for printing to PDF via webContents.printToPdf
Refactor note title sanitization to shared function
Refactor code to not use any static HTML file (and thus no javascript, safer for XSS)
Refactor code to be more readable
Reorder menu items for md, html and pdf
Refactor includeFrontMatter fetching
Add support for mathml rendering in PDF export (fix escapes)
Add support for proper header and footer in PDF
  - Include front matter option in Markdown - Export section to get header and footer
Comment thread src/lib/exports.ts Outdated
const getFrontMatter = (note: NoteDoc): string => {
return [
'---',
`title: "${note.title}"`,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should sanitize title and tags to prevent syntax errors

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see, I just extracted this method, so didn't know.
See you fixed it with yaml, thx!

Comment thread src/lib/exports.ts Outdated
return [
'---',
`title: "${note.title}"`,
`tags: "${note.tags.join()}"`,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tags should be yaml compatible list, not a concatenated string

Comment thread src/lib/exports.ts Outdated
import CodeFence from '../components/atoms/markdown/CodeFence'
import { getGlobalCss, selectTheme } from './styled/styleUtil'

const sanitizeNoteName = function (rawNoteName: string): string {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filenamifyNoteName should be better.

@Rokt33r Rokt33r force-pushed the feature/add-export-note-to-pdf branch from 9f80d9a to 3a7c833 Compare November 21, 2020 08:26
@Rokt33r Rokt33r merged commit b2a3dab into BoostIO:master Nov 21, 2020
@Rokt33r Rokt33r added this to the v0.11 milestone Nov 21, 2020
@Rokt33r Rokt33r removed the awaiting review ❇️ Pull request is awaiting a review. label Nov 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants