This package provide the panel with navigation through custom symbols in text editors. The items of tree are created manually by inserting special marks into text editor. Multiple scopes are supported (see below) with their own marker system. You can open or hide panel by commands navigation-panel:open
and navigation-panel:hide
, optionally use navigation-panel:toggle
. Package has fully support multiple cursors.
The package introduces the concept of multi-level headers. The user enters a tag with a level, which indicates the maximum level of the text associated with a given tag. The true level of the header will be determined when building the header tree using the rule that the header can have a level at most one greater than its predecessor. For example, if you enter a level 1 heading, then a level 2 heading, then a level 5 heading, then the real level of the last heading will be 3. The marker designations are for real headers. The real section level is use everywhere instead of user level.
For each header, the package can create a marker to highlight the line text in the editor. The marker style can be customized.
Mark headers by categories. The categories can be filtered in bottom bar of panel, context menu of panel or by command. The categories are predefined: info, success, warning, error. The meaning of the categories depends on the creativity of the user, use them as you like.
The settings of categories can be changed globally in package settings or locally by commands or in panel:
navigation-panel:all-categories
: activate all categories,navigation-panel:none-categories
: deactivate all categories,navigation-panel:categories-toggle
: toggle all categories,navigation-panel:info-toggle
: toggle info category headers,navigation-panel:success-toggle
: toggle success category headers,navigation-panel:warning-toggle
: toggle warning category headers,navigation-panel:error-toggle
: toggle error category headers,navigation-panel:standard-toggle
: toggle category-less headers.Elements of the header tree can be collapsed. This can improve workflow or document clarity. The global settings can be changed in package settings and local settings by context-menu of panel of by commands:
navigation-panel:collapse-mode
: collapse all headers by default,navigation-panel:uncollapse-all
: uncollapse all headers by default.You may also be interested in the autoCollapse
option, which will automatically expand only the active tree elements, while collapsing the rest. You can toggle setting globally in package settings or locally by context-menu of panel or by command:
navigation-panel:auto-collapse-toggle
: toggle state of autocollapse setting.There are functions which provide fold actions (fold, unfold or toggle) of sections. The special future is to collapse all section a view like table of content. You may be interested in following commands:
navigation-panel:fold-toggle
: toggle fold of current section,navigation-panel:fold-section
: fold current section,navigation-panel:fold-section-at-n
: fold last section at level n,navigation-panel:fold-as-table
: fold all section but in nested form,navigation-panel:fold-all-infos
: fold as table, but only headers with category info
,navigation-panel:fold-all-successes
: fold as table, but only headers with category success
,navigation-panel:fold-all-warnings
: fold as table, but only headers with category warning
,navigation-panel:fold-all-errors
: fold as table, but only headers with category error
,navigation-panel:unfold
: unfold current section,navigation-panel:unfold-all
: unfold all sections.In order to search for markers in a text editor, all lines of the editor are tested by global regular expressions. If the global expression returns a positive search result, the matched lines are further prepared. Global expressions can be found below, different for each scope.
You can test and analyze regex's below at regex101. Just select flavor as ECMAScript (JavaScript)
and paste statement.
The panel can be adapted to the user's needs in many ways. Several options are outlined below. The colors can be adjusted to user preference and ui/syntax theme in styles.less
(File/Stylesheet..).
e.g. all markers has highlighted background, but level 1, 2 and 3 has their own color:
.navigation-marker {
background: rgba(233, 228, 141, 0.3);
}
.navigation-marker-1 {
background: rgba(197, 218, 131, 0.3);
}
.navigation-marker-2 {
background: rgba(250, 192, 209, 0.3);
}
.navigation-marker-3 {
background: rgba(200, 197, 243, 0.3);
}
e.g. add top border to markers with level 1:
.navigation-marker-1 {
border-top: 0.016px solid @text-color-info;
}
change font to monospace (or any other...):
.navigation-panel {
font-family: monospace;
}
Global regular expression is ^(=={0,5}|#\#{0,5})[ \t]+(.+?)(?:[ \t]+\1)?$
.
Global regular expression is ([^%\n]*)%(\$+)([\*\+\-\!\_]?)%(.*)|^[^\%\n]*\\(part*?|chapter*?|section*?|subsection*?|subsubsection*?|paragraph*?|subparagraph*?)\*?(?:\[(.*)\])?{(.*)}
. The \part{...}
is equal level 4, \chapter{...}
is level 5 etc. The section commands can be changed in package settings.
%$!% Countries
-> 1. Countries
with error category%$$% United Kingdom
-> 1.1. United Kingdom
\part{Resources}
-> 1.1.1.1. Resources
\part[Resources]{Resources but to long to TOC}
-> 1.1.1.1. Resources
In case of ([^%\n]*)%(\$+)%(.*)
, the additional letter can be used to provide additional visual effect:
*
: info category+
: sucess category-
: warning category!
: error category_
: separator categoryGlobal regular expression is ([^%\n]*)%(\$+)([\*!-]?)%(.*)|^[ ]*\@(\w*)[ ]*{[ ]*([^\,]*)
. The @<type>{<text>,
is level 6.
%$% Bibliography about countries
-> 1. Bibliography about countries
%$$% United Kingdom
-> 1.1. United Kingdom
@book{jk2021, ...
-> 1.1.1.1.1.1. jk2021
Additional letter can be used to provide additional visual effect:
*
: info category+
: sucess category-
: warning category!
: error category_
: separator categoryGlobal regular expression is ^ *(\#+) (.*)
. The level is defined as count of #
. The number of levels is endless.
# Countries
-> 1. Countries
## United Kingdom
-> 1.1. United Kingdom
Global regular expression is ^([^#\n]*)#(?:%%)?(\$+[spv1]?|\?)([\*\+\-\!\_]?)#(.*)
where count of $
mean the level on list.
Additional letter can be used to provide additional parse effect:
s
: get only text from first string which occur in this linep
: python def or class; show only type and name of objectv
: variable; show only name of variable1
: use only first word (split by whitespace), without optional after-colonAdditional letter can be used to provide additional visual effect:
*
: info category+
: sucess category-
: warning category!
: error category_
: separator categoryAs special case you can use #?#
or #?<category>#
which mean auto level base on pattern <any>(<lvl as int>, "<text>"<any>)
. It is useful e.g. in PyLaTex or similar.
#$# Countries
-> 1. Countries
#$$# United Kingdom
-> 1.1. United Kingdom
a = 5 #$$v#
-> 1.1. a
class MyCounty(Country): #$$p#
-> 1.1. MyCounty
document.section(1, 'Countries') #?!#
-> 1. Countries
document.section(2, 'United Kingdom') #?+#
-> 1.1. United Kingdom
with sucess categorydocument.section(2, 'United Kingdom') #?!#
-> 1.1. United Kingdom
with error categoryGlobal regular expression is ^(.+)\n([!-/:-@[-[-~])\2+$
.
Global regular expression is ^ *(#define [^\n=]+$|#enddef)|(^(?! *\$)[^!\n]*)!(\$+)!(.*)|^!.!chapter +(.*)|^ *(.)?prog +([^\n]*)(?:\n *head +(.+))?|^ *!.! +(.*)|^\$ graphics +(\d+) +\| +picture +(\d+) +\| +layer +(\d+) +: *(.*)
. The chapter is level 4, prog is level 5 and label is level 6.
!$! Design slab
-> 1. Design slab
!$$! Req. reinforcement
-> 1.1. Req. reinforcement
!+!Chapter Design
-> 1.1.1.1. Design
+prog aqua
-> 1.1.1.1.1. aqua
+prog aqua \n head sections
-> 1.1.1.1.1.1. aqua: head sections
If you have idea how to improve the package, see bugs or want to support new scope, then feel free to share it via GitHub.
Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.