@pmario in the brainstorm mode one thought I had was using line numbers, if you use codemirror with line numbers displayed when editing, you can imagine a preview pane that renders the tiddler but displays the source line number “when available” to the left of the preview content. Providing the ability to move to next previous line number in the preview. Limited to only line numbers that have an identifiable position in the preview.
- I kind of imagine a set of generated anchors during the preview render process (uniquify with the tiddler name)
The idea would be that a toggle be available when navigating the editor could make the preview jump to the matching line number, where available. In many cases which will be what the user wants, both when writing prose or code. Where the physical line number can’t be “represented” in the preview, they would collapse into one;
09
10 <$list ..
11 content
12 </$list>
13
14 {{transclusion}}
15 <hr>
16
The preview pane would look something like this
09
10 top of list generated
01 1st list line
02 2nd list line
03 4th list line
13
14 top of transclusion
01 1st list line
02 2nd list line
15 ---------------------------------
16
- In the above example if in the edit pane you are on lines 10, 11 or 12. the preview remains at position 10 because these are inside the list widget, unless you use the alt-down which will scroll to the next virtual line number.
Of course when the code results in multiple lines being rendered such as the result of a list widget the previews line numbering will present multiple lines without a line number. However we could then introduce another mechanism or method for the user to scroll this content in the preview, such as a alt-up arrow or alt-down arrow to scroll the rendered content, up or down key in editor would jump to known line numbers.
We could generate a subset of virtual line numbers in rendered content that can be navigated, based on the rendered HTML.
I imagine the preview would have two left hand columns, one referencing the physical line number in the source code, the second virtual line numbers that appear between physical line numbers. Basically it will then be possible for the user to understand and navigate the difference between physical and virtual lines in the preview.
I have some ideas about the mechanisms to achieve this which we can discuss.
- Eg an alternative parser that accepts the wiki text with line numbers in the first position of every line, that can be displayed in the previewer when possible, without altering how the text is rendered.
Tones