vkbo / novelWriter

novelWriter is an open source plain text editor designed for writing novels. It supports a minimal markdown-like syntax for formatting text. It is written with Python 3 (3.9+) and Qt 5 (5.15) for cross-platform support.
https://novelwriter.io
GNU General Public License v3.0
2.03k stars 103 forks source link

Allow tag tracking from Project Notes #1686

Open helisdevbox opened 8 months ago

helisdevbox commented 8 months ago

I've looked at the issues 1556 and 1439, and it's clear that the tag system won't be changed any time soon. However, I'd like to add this suggestion in case tags or navigation is rewritten at some point.

I have fairly large pool of characters, locations and objects outlined in their respective notes in novelWriter, but not all of them are in use yet. As both the manuscript and project notes/ideas keep growing, I've found myself hoping for two enhancements for tag navigation:

  1. I'd like to be able to see where the tag is used from the note itself (= where the tag is defined), and to be able to jump around from the note when changes need to be made in multiple files. Finding tag's usages is already covered in project outline view for the manuscript, but I typically need to edit other notes as well, and those don't show up in the outline.

  2. I'd like to be able to see unused tags at a glance. This can be covered by i.e. placing used and unused tags in separate notes/folders, but it would be easier to handle this without moving files around. Moving and editing notes is also slightly hampered by the lack of multi-pane editing, as I usually need to edit more than one file when moving them around.

So what I'm looking for is something akin to variable tracking in IDEs, where you track the usages of a variable from where it's defined. I realize this probably is out of this project's scope, but one can hope. :)

vkbo commented 8 months ago

A list of the places a tag is used can be seen in the references panel below the viewer when a note is open there.

vkbo commented 8 months ago

As for the unused tags part, there is no easy way to see it currently. The information is not readily available in the index either. The list of references to a note that is visible in the references panel is computed when requested. Mostly to make sure it is up to date and correct.

What you can do instead of the idea to move the notes to different folders, is to set the unused ones as "inactive" in the project tree. You can then filter them out of, say, the Character tab in the panel below the viewer. There is an option for it in the dots menu there. It's not an automated solution, but the list will only show used tags and the project tree has a visual distinction.

I'll look into adding a column listing a usage count, or something similar.

xahodo commented 7 months ago

How about when a note with a particular tag is open, all documents where it is used light up in the project tree? That gives some nice visual feedback. The advantage of the visual feedback over having it in the panel is that it can be seen at a glance, and the user can get an immediate idea whether he perhaps used it too often.

vkbo commented 7 months ago

Yes, this is already in your feature request #1576.

Both here, and in the feature ticket, it is assumed that the user is structuring the documents in a specific way. There is no rule that says a tag must be in a single document, nor that scenes or chapters must be separated so that the visualisation makes sense. I frequently define multiple tags in a document, so which one should I highlight?

The Novel View is the one that actually breaks down the structure regardless of how files are organised, so this is where this would need to be. You can already list tags and references in this view, and adding the colouring there makes more sense.

awqk commented 7 months ago

I am also looking for a way to get a list of documents involving a particular tag.

Let's say I have 20 plot elements (example: @plot: Q vs Z about son --> Q disagrees with the way Z treats her adolescent son), and let's say I tagged all 200 scenes in my 300 page novel with every plot element they touch upon with an appropriate @plot tag.

I would expect some kind of filter feature in the outline view: only show documents where @plot: Q vs Z about son appears.

Something like this would address the thread opener's problem as well:

  1. I'd like to be able to see where the tag is used from the note itself (= where the tag is defined)

that's what the filtered Outline View would be showing

  1. I'd like to be able to see unused tags at a glance.

You wouldn't see all the unused tags, but the unused ones would at least come up with an empty list.

vkbo commented 7 months ago

I am also looking for a way to get a list of documents involving a particular tag.

That is already available from the References panel below the document viewer. As mentioned in the second comment. It shows a list of documents where the current document is references, but if the document contains one tag, that's effectively what the list shows.

I would expect some kind of filter feature in the outline view: only show documents where @plot: Q vs Z about son appears.

In 2.3 there will be an option to export the Outline view as a CSV file, which can be opened as a spreadsheet. Then you can filter and sort it in whatever way you want.

You wouldn't see all the unused tags, but the unused ones would at least come up with an empty list.

As mentioned earlier, I'll look into adding a counter for how many times a tag is references. The tables in the References panel are sortable, so that should make it easier too.