You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-29 22:48:10 +02:00
Updated website
This commit is contained in:
@@ -495,14 +495,14 @@ joplin.plugins.register({
|
||||
|
||||
});
|
||||
</code></pre>
|
||||
<p>Later you will also need a way to generate the slug for each header. A slug is an identifier which is used to link to a particular header. Essentially a header text like "My Header" is converted to "my-header". And if there's already a slug with that name, a number is appended to it. Without going into too much details, you will need the "slug" package to generate this for you, so install it using <code>npm i -s slug</code> from the root of your plugin directory.</p>
|
||||
<p>Later you will also need a way to generate the slug for each header. A slug is an identifier which is used to link to a particular header. Essentially a header text like "My Header" is converted to "my-header". And if there's already a slug with that name, a number is appended to it. Without going into too much details, you will need the "slug" package to generate this for you, so install it using <code>npm i -s 'git+https://github.com/laurent22/uslug.git#emoji-support'</code> from the root of your plugin directory (Note: you can also install the "uslug" package on its own, but it won't have emoji support).</p>
|
||||
<p>Then this is the function you will need for Joplin, so copy it somewhere in your file:</p>
|
||||
<pre><code class="language-typescript">const nodeSlug = require('slug');
|
||||
<pre><code class="language-typescript">const uslug = require('uslug');
|
||||
|
||||
let slugs = {};
|
||||
|
||||
function headerSlug(headerText) {
|
||||
const s = nodeSlug(headerText);
|
||||
const s = uslug(headerText);
|
||||
let num = slugs[s] ? slugs[s] : 1;
|
||||
const output = [s];
|
||||
if (num > 1) output.push(num);
|
||||
@@ -653,9 +653,7 @@ document.addEventListener('click', event => {
|
||||
if (message.name === 'scrollToHash') {
|
||||
// As the name says, the scrollToHash command makes the note scroll
|
||||
// to the provided hash.
|
||||
joplin.commands.execute('scrollToHash', {
|
||||
hash: message.hash,
|
||||
})
|
||||
joplin.commands.execute('scrollToHash', message.hash)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user