Closed vi closed 10 years ago
Hmm I don't have an idea how to do it cheaply (without an army of hired coders) At first, markdown is processed with markdown engine, and I don't know how to map position in the source to position in the output HTML. At second, HTML is rendered with QWebView, and I don't know how to map byte offset in the HTML to scrollbar position.
It can be done with a workaround: you modify the page: add anchors to HTML that corresponds to each source code line (or something similar).
Of course Enki's html mangling should be an option, not hardcoded.
The feature is expected to be useful even if covers majority of cases, not the general case.
Mangle HTML and reload page can be triggered when user activages "Scroll preview to source" or "Lock preview and source scrollbars together" function. There can be a notice that it is experimental feature and can break some html pages.
Similar thing can be done for markdown: add special paragraphs (or just text chunks), then find and remove them on HTML level.
For the most part, the preview_sync additions do this -- there's a few bugs to work out, but I'd this is can be closed...
A large html/markdown file is opened in Enk. I use Search to locate something in the source.
Now I want automatically make Preview pane scrolled to that position.
I expect this to work for all markdown files and basic (without tricky JS that fills up DOM with content) html files.
Current use case: I have big html documentation file opened along with other project files and want to look up something in it.
Note: the feaure should not be enforced: I should be able to edit the code without preview automatically scrolling to any position. Locked preview position <-> code position can be a separate menu checkbox.