Interactive indexing#4467
Conversation
|
Unfortunately your test brew disappeared when the PR 3313 closed. Can you remake it?
Should this be |
|
I can't seem to get the crossreference mode to work with the alternative options. #Topic A|Cross B - Works |
…ery into interactive-indexing
I forgot to update the heroku URL.
yes. I missed that entry when we made some changes to the syntax. |
Cross references are dropped on the floor if the lookup doesn't exist. I can't tell from this snippet if you had one. Compare with this https://homebrewery-pr-4467.herokuapp.com/share/T9i5qU8UxHcK |
Yep, it exists. You can see I mentioned the first case works fine. The other three use the same lookup but emit nothing. I'll check out your example in the mean time. |
This part of the ciode had been left idle and incomplete since early on in the PR. This update corrects the regex and range matching, sets up the styling, and updates the comment to reflect syntax being highlighted.
Hmm. It is failing with an implicit index, but not with an explicit... |
A bug was found with implicit indexes and crossreferences that did not bear out in my test set. Refactoring and simplifying? was found in the fix.
|
@calculuschild Try your failures now. |
Where would this index entry appear?
|
I see an error crept in when I updated the example text. The quoted example should be:
Assuming the one in your question follows suit, it should be
This would create a top level entry in the Games appendix. |
Semi-Dynamic Index building for Markdown+
Build simple, rich, or hybrid indexes with internal links. Fixes #3369
Usage
Both usage cases center around the use of the index marked extension.
Multiple Indices
This system is capable of tracking multiple indices. Entries without a declared index in their formatting will be placed in the default index
Index. An index marker is a block-level marker.Simple Index
Anywhere in the document add an index marker with no label and a list of terms to be indexed. Terms will be searched for in a case and whitespace insensitive manner.
Complex Index Entry
There are a number of variations that can be employed here. The only requirement is the line starts with a
#, has no space, and contains a Topic - and Index and a Subtopic are optional.This generates an entry for
Fireballunder the topic ofElemental Spellsin theAppendix: Magicindex.This generates the topic of
Elemental Spellsin theAppendix: Magicindex.This generates the topic of
Elemental Spellsin the default index.This generates an entry for
Fireballunder the topic ofElemental Spellsin the default index.Crossreferences
This system supports crossreferencing index entries. Crossreference hyperlinks link to the crossreference target rather than a page number. Crossreference targets do not need to exist in the brew prior to being referenced; missing targets will result in the references being silently dropped on index generation.
Crossreferences are implemented by appending
|followed by an optional key and then the index entry to reference.amples:
The optional keys are:
The reference type is prepended to the target. The code does not enforce any particular style guide.
The above example would generate:
Generating the Index
The rich index snippet, when executed, combines the simple and rich index entries into a single, alphabetized index.
If you have simple and rich entries, rich entries will be folded under the simple entries as follows:
{{index,wide }}container. If muliple indices exist, they will appear in alphabetical order separated by a\page.Known issues.
Other notes
I'm not the most efficient JS coder. I'd be very unsurprised if some of this could be condensed.
Test Brew ShareID: https://homebrewery-pr-4467.herokuapp.com/share/vtI5G0Zl_fan
This is a reconstruction of #3113 from my old fork to my new one.