/* eslint-disable no-console */
// const data = `
Trilium really does rock! Don't believe me? Well this entire website was made using the shared notes feature inside Trilium with a little bit of extra CSS and JS also contained in Trilium.

It turns Trilium into an insanely powerful WYSIWYG website creator. But that's just a side feature of Trilium, it's so much more powerful with endless possibilities.
If somehow you aren't already convinced, take a look below for even more reasons why Trilium rocks!
This section is shamelessly borrowed from Trilium's README.
Nriver maintains an awesome list of addons for Trilium made by the community. Check out the official list on GitHub. We do mirror the list here on the Showcase page if you just want a quick look.
In addition to using community made scripts, widgets, themes, and everything in between, Trilium leaves things open-ended for you the end-user. You can script as much or as little as you like inside Trilium. You can automate all kinds of workflows, do data analysis, or even simple things like set a keybind to open a specific note. The world is your oyster as they say, and Trilium is your world. Pretend that made sense.
This website is not at all affiliated with Trilium Notes or its creator(s). The site is broken up into a few main sections that you can see in the navigation bar at the top of the page. At a high level, there's two sections targeting end-users, two sections targeting developers, and one meant for everyone.
This site is still a work-in-progress! Writing documentation isn't the most fun thing in the world so this will just be something I work on when I have free time. You'll usually find me working on one of my Trilium-related addons, Trilium itself, or my other open-source project: BetterDiscord.
Rather than saying some specific goals of what this site strives to be, I'll say what it strives not to be; This site is not meant to be a complete recreation of the Wiki with every detail and page included. It is meant to be a (mostly) one-stop shop for users and developers alike looking to supplement their knowledge. It may at some point expand and include everything from the wiki because users tend to prefer a fancier UI like this, but it is not the end-goal.
Since this entire site is just a share from my personal Trilium instance, there is no easy way to contribute new pages or fixes for typos. At some point I will create a GitHub repository for this site's supplementary CSS and JS, and that repository can also act as a home for issues and discussion. But who knows, maybe within that time frame I'll think of some clever way to introduce contributions.
`; const data = `
The frontend api supports two styles, regular scripts that are run with the current app and note context, and widgets that export an object to Trilium to be used in the UI. In both cases, the frontend api of Trilium is available to scripts running in the frontend context as global variable api. The members and methods of the api can be seen on the FrontendScriptApi page.
Scripts don't have any special requirements. They can be run at will using the execute button in the UI or they can be configured to run at certain times using Attributes on the note containing the script.
This attribute is called #run and it can have any of the following values:
frontendStartup - executes on frontend upon startup.mobileStartup - executes on mobile frontend upon startup.backendStartup - executes on backend upon startup.hourly - executes once an hour on backend.daily - executes once a day on backend.These events are triggered by certain relations to other notes. Meaning that the script is triggered only if the note has this script attached to it through relations (or it can inherit it).
runOnNoteCreation - executes when note is created on backend.runOnNoteTitleChange - executes when note title is changed (includes note creation as well).runOnNoteContentChange - executes when note content is changed (includes note creation as well).runOnNoteChange - executes when note is changed (includes note creation as well).runOnNoteDeletion - executes when note is being deleted.runOnBranchCreation - executes when a branch is created. Branch is a link between parent note and child note and is created e.g. when cloning or moving note.runOnBranchDeletion - executes when a branch is delete. Branch is a link between parent note and child note and is deleted e.g. when moving note (old branch/link is deleted).runOnChildNoteCreation - executes when new note is created under this note.runOnAttributeCreation - executes when new attribute is created under this note.runOnAttributeChange - executes when attribute is changed under this note.Conversely to scripts, widgets do have some specific requirements in order to work. A widget must:
module.exports.parentWidget member to determine where it should be displayed.position (integer) that determines the location via sort order.#widget attribute on the containing note.this.$widget and render it in doRender().this.$widget and doRender() are already handled and you should instead return the value in doRenderBody().left-pane - This renders the widget on the left side of the screen where the note tree lives.center-pane - This renders the widget in the center of the layout in the same location that notes and splits appear.note-detail-pane - This renders the widget with the note in the center pane. This means it can appear multiple times with splits.right-pane - This renders the widget to the right of any opened notes.For more information on building widgets, take a look at Widget Basics.
`; const headingRe = /(