Plugin to enable line numbers

Created a plugin to enable line numbers in Joplin for code mirror editor.

It's a very simple plugin that just sets the code mirror option to enable line numbers as true.

Download jpl file to install from: https://github.com/shantanugoel/joplin-plugin-cm-linenumbers/releases/tag/1.0.0

Code location: https://github.com/shantanugoel/joplin-plugin-cm-linenumbers/tree/main/src

11 Likes

Awesome, I just installed (first plugin!!!) and it works like a charm!!!

Since I use the vim keybindings, do you think something like relative line numbers would also be possible?

1 Like

Great, it works well! I wonder if it would be possible (or desirable) to have a single plugin that toggles various codemirror settings - e.g. I would also find the code-folding option interesting!

1 Like

Thank you for the plug-in, it is very easy to use, a little suggestion:

Can the line number of the cursor line be highlighted? Thank you

It's possible I think but I'm knee deep in work these days. Will try to take a look at it in some time.

Is there a reason why this is not in the "Official" Plugin Repository?

Seriously: If there is an issue with this plugin that has caused the devs to feel that it's not worthy of being included, please let us know.

The dev has to publish to npm. If the dev doesn't do that, there's nothing we can do. Read

Is this the right place to ask about css for the line numbers? I'm trying to add space between the line numbers and the text. For me there is no margin between the text and the line number "bar" @uxamanda have you looked into this? You are the Joplin css wizard!

Ha, I appreciate the vote of confidence. Credit goes to the real wizard @dpoulton, who noticed that the plugins cannot access the custom CSS. Looks like they were working on a solution, but I think the plugin dev would have to implement. Plugin: Note Tabs - #122 by dpoulton

1 Like

Actually these styles can be changed via the userchrome.css. Because this plugin only enables a feature of the CodeMirror editor. I am using the following snippet in my userchrome.css:

/* Real CodeMirror line numbers */
.CodeMirror-gutters {
  background: none !important;
  border: none !important;
}
.CodeMirror-linenumber {
  color: rgba(150, 150, 150, 0.4) !important;
}

So you should be able to found the correspondig classes via the development tools.

2 Likes

Thanks! Your css worked for me. I'm not sure why I was unable to find those classes.

Is it possible that this plugin is not working with the latest update? I am now using Joplin 2.3.5 and version 1.0.0 of this plugin. I'm not seeing the numbers anymore.

1 Like

Apologies for being away. Life happened :slight_smile:
A good samaritan made the fixes for the compatibility updates. I've merged and made a release here Release v2.0.0 · shantanugoel/joplin-plugin-cm-linenumbers · GitHub

Will publish on the npm registry/joplin repository tomorrow (I made a mistake while publishing on npm and had to delete it. Now npm requires me to wait for 24 hours before publishing)

4 Likes

Thank you so much for creating the plugin and now for updating it.