rauenzi / Trilium-LaTeXPreview

A widget for Trilium Notes to preview LaTeX notes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trilium-LaTeXPreview

A widget for Trilium Notes for live previewing LaTeX files with support for sync scroll.

Preview

trilium_9xffklenTJ.mp4

Features

  • Preview LaTeX notes in real time
  • Global and per-note styles
  • Syncable scrollbars

Installation

  1. Download the zip file from the latest release on GitHub.
  2. Import the zip into Trilium, but make sure you uncheck Safe Import!
  3. (optional) Create one (or more) child code notes of CSS type and fill it with any global LaTeX styles.

Usage

Create a code note with LaTeX type. Then, to make a note previewable, simply add the #latexPreview attribute to it. (You may have to switch notes afterward for the preview to appear.)

After that, just start writing in LaTeX on the code editor side. You'll see the preview update with you as you go. By default, it waits about a second before updating the preview in order to reduce performance overhead.

If you're going to add any styles to the note, it can be annoying to see the preview cards at the bottom. You can hide those by adding the #hideChildrenOverview native to Trilium.

Scroll Sync

By default, LaTeXPreview will try to keep the scroll bars in sync no matter which side you are scrolling. The widget is not perfect at keeping them exactly at the same place contextually because the rendering can be so different.

Disabling

You can disable the sync entirely by adding the #latexScrollSync attribute with none as the value. You can also disable each side separately with left or right. For instance, if you want the preview to automatically scroll as you scroll the source, but not the other way around, then use #latexScrollSync=left.

Styling

Both the global and local styles are picked up and reapplied on note switch, so no need to keep reloading if you are tinkering with your styles!

Global

As mentioned in the installation section, any CSS note that is a child to the widget code will automatically be picked up and applied.

Local

Local styles are specific to the LaTeX note. Just make a CSS note as a child of the LaTeX note and it'll be picked up!

Links

Check out my other Trilium-based projects:

Want more? Be sure to check out the Awesome Trilium list!

About

A widget for Trilium Notes to preview LaTeX notes.

License:Apache License 2.0


Languages

Language:JavaScript 97.5%Language:CSS 2.5%