Repository navigation
Allowed Headings
Nicholas Hoyt edited this page Jun 28, 2019
·
19 revisions
This document details the various scenarios we account for in the new Heading / Paragraph algorithm that includes a look-ahead feature used in determining which heading levels are allowed for a particular situation.
We label the scenarios by referencing the index values indexPrev and indexNext, which correspond to the indices for the previous and next heading, respectively, relative to the headings array [h1, h2, h3, h4, h5, h6]. For example, the index for h2 is 1.
The following are the three scenarios with example cases:
-
Cursor is between
h3andh4- Old:
h1, h2, h3, h4 - New:
h3, h4
- Old:
-
Cursor is between
h3andh5- Old:
h1, h2, h3, h4 - New:
h3, h4, h5
- Old:
-
Cursor is between
h3andh6- Old:
h1, h2, h3, h4 - New:
h3, h4, h5, h6
- Old:
-
Cursor is between
h4andh4- Old:
h1, h2, h3, h4, h5 - New:
h3, h4, h5
- Old:
-
Cursor is between
h4andh3- Old:
h1, h2, h3, h4, h5 - New:
h2, h3, h4, h5
- Old:
-
Cursor is between
h5andh3- Old:
h1, h2, h3, h4, h5, h6 - New:
h2, h3, h4, h5, h6
- Old:
-
Cursor is between
h6andh3- Old:
h1, h2, h3, h4, h5, h6 - New:
h2, h3, h4, h5, h6
- Old: