GithubHelp home page GithubHelp logo

notion-html-to-pdf's Introduction

Notion HTML to PDF Formatter

A Tampermonkey javascript to make pdf exporting notion notes easier and customizable.

Notion does not have functionality to set page breaks and other formatting options for the pdf export of notes. This script changes that by taking the html export of notion notes and replacing note paragraphs with specific content with configurable styles.

Tampermonkey

Tampermonkey is a Google Chrome extension you can use to execute javascript on specific websites.

Configuration

This is what the configuration section looks like currently.

const formattingConfig = [
  { id: 1, key: "/pb-b", style: "page-break-before: always;", description: "page break", type: "styling_obj" },
  { id: 2, key: ".simple-table td", style: "min-width: 0px;", description: "remove min-width from table data", type: "css_overwrite" },
  { id: 3, key: ".simple-table th", style: "min-width: 0px;", description: "remove min-width from table header", type: "css_overwrite" },
];

Here, every time the user has a paragraph in their notion with the text /pb-b, it will add the style page-break-before: always; to this paragraph element. It will as well remove the text from the element so you dont have to worry about the /pb-b being displayed.

For the configs with type css_overwrite, it will queryselect all the elements with the classes as stated under config-key and add styling as configured in style.

notion-html-to-pdf's People

Contributors

omeldar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.