Homepage    |    GitHub    |    API    |    FAQ

Enable Roboto font for plugins

Joplin bundles the Roboto font and uses it by default (via a link rel="stylesheet").

However, plugins cannot use this resource the same way, because addScript explicitly restricts paths to the plugin baseDir.

The following code happens to work (if that check is bypassed) but would couple a plugin to the directory structure of the app.

await panels.addScript(view, '../../node_modules/roboto-fontface/css/roboto/roboto-fontface.css');

Still, it would be nice to access the bundled font for styling a plugin with the default --joplin-font-family as described in the tutorial.

https://joplinapp.org/api/tutorials/toc_plugin/#styling-the-view

Otherwise, one has to also ship the Roboto font w/the plugin or rely on it being installed as a system font (both of which seem a little bit of overhead). This is also the case for font-awesome.

How about a panel.addDefaultStyles(...) that injects the appropriate tags, without the plugin "knowing" about the particular location of the CSS files?

Or -- is this by intention, such that "package all your assets w/your plugin" is in fact correct?