gitbook-cli
gitbook-cli copied to clipboard
Navigating to internal link causes exception
I am using gitbook-cli (ver: 2.3.0) to document my project: https://astx-redux-util.js.org/.
When navigating to an "internal link" I receive the following uncaught exception:
theme.js:4 Uncaught TypeError: Cannot read property 'split' of undefined
Internal Link
What (you may ask) is an internal link?
An internal link is one that is accessible from within the documentation only - NOT cataloged in the TOC (SUMMARY.md).
This is used in my API docs, where you wish to reference a detail that is not part of my library, rather an external detail. As a result, it has not TOC entry.
Repeat as Follows
Follow these steps to see this issue:
- Navigate to this page (of my docs): https://astx-redux-util.js.org/1.0.0/api.html#conditionalReducer
- In the parameter table, click the
conditionalReducerCBType (this is an internal link). - The conditionalReducerCB entry is correctly visualized.
- However:
- the following uncaught exception is emitted (see browser console):
theme.js:4 Uncaught TypeError: Cannot read property 'split' of undefined 111 - and the browser URL is NOT updated properly ... shows #reducerHash ... should be: #conditionalReducerCB
- the following uncaught exception is emitted (see browser console):
Analysis
I haven't actually looked at the code, but the error has to be related to logic that is attempting to highlight the selected section in the left-nav ... and because it is an "internal link" there is nothing to highlight.
Presumably, this is the last step in the logic flow, because it is functionally working ... just with an unwanted error thrown.
It would seem to me that in this case it would be appropriate for the logic to recognize this scenario, and just silently ignore the case where it cannot find the left-nav link to highlight.
Thoughts?