Skip to content

Add support for templates, and use chrome rendering (with option to opt-out)#68

Open
avncharlie wants to merge 4 commits intoScrybbling-together:mainfrom
avncharlie:templates
Open

Add support for templates, and use chrome rendering (with option to opt-out)#68
avncharlie wants to merge 4 commits intoScrybbling-together:mainfrom
avncharlie:templates

Conversation

@avncharlie
Copy link

This PR bundles reMarkable templates into remarks, and adds functionality to render templates.

Here's a notebook rendered with this PR with some complex templates: Templates.pdf
Sample page:
image

Templates files are a set of instructions of how to draw a template, including setting up variables, and then providing repeating patterns that use these variables to draw templates. This code is in: remarks/conversion/template.py.

This involved an architecture change - instead of using RMC to generate a pdf, we now use it to generate a svg, which we then add our template svg to in the background, and then convert to PDF. Doing this means we need to use chrome/chromium headless to keep the embedded fonts in the rmc output. This PR adds that via calling this functionality which is already in rmc (in PR: Scrybbling-together/rmc#10)

There's also a --no-chrome option to keep using the cairo pdf conversion and lose the fonts, and --chrome-loc argument to specify chrome location if remarks/rmc can't find it.

@Azeirah
Copy link
Collaborator

Azeirah commented Mar 1, 2026

I cannot merge the templates since they are copyrighted. I will not merge those without explicit permission from reMarkable.

The logic is otherwise great though, especially with the --template-dir env var it makes a lot of sense to have graceful degradation if there are no templates.

I'm looking into whether it's possible to get the templates through rmapi, otherwise it's a bit awkward to set-up :/

Claude suggested just writing the templates by hand with different variable names and the like, because what's copyrighted is the reMarkable-authored JSON files, not the concept of a lined document that's uhh... Honestly not the stupidest idea? But I do think it's a lot of work to author all of them from scratch.

I think it's fine to merge this with the following changes

  • The --template-dir var needs to be documented in the Readme, including where you can get the template files from manually (I don't know the exact path from the top of my head).
  • The template files need to be removed for now, unfortunately
  • Need to make sure that this script degrades gracefully if the template is missing. Would be good to have as an explicit test-case.

…to reMarkable templates and fonts they provide
@avncharlie
Copy link
Author

I've added these changes, including allowing the user to set the reMarkable fonts from remarks (using the --fonts-dir option). This involved updating rmc, the corresponding pull request is here: Scrybbling-together/rmc#15

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.

2 participants