-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for location synchronization between editor and preview #11
Comments
I am looking into this, the VSCode built-in extension for markdown files already does "scroll sync", but the code is somehow complex. I will do some more research on that code. |
+1 |
wish |
I am super keen for better syncing as well. My coding skills are quite modest but hopefully I can be a research assistant! See asciidoctor/asciidoctor.js#127
|
@danyill thanks for the research, I was not aware of the sourcemap option. I am trying to reuse as much as possible code from the markdown extension, I will see if a similar logic can be implemented from the source_map metatata. |
Metadata is in 9f04dad I had to look at the AsciidoctorJS source to figure how to use loadFile(), findBy(), getLineNumber(). addRole() . I need to contribute to improve the documentation from https://github.com/asciidoctor/asciidoctor.js/blob/master/docs/manual.adoc , once this issue gets closed. I am missing the mapping/scroll part in VS Code :) |
I have been looking into markdowns's synchronization code, and from my understanding, it depends on a feature (vscode.window.createWebview) which is only available from the "proposed API", which is restricted to internal VSCode extensions. Will be tracking microsoft/vscode#28263, hoping that createWebview becomes available for general use. |
After some research I was able to figure a solution for the preview sync with source. Is not perfect but I was the best I could do :P . Those who have the skills please checkout from git, test it, and provide some feedback. The preview is now "omnidoc", meaning you just need one view for multiple docs,t will get updated depending on the .adoc that is being edited. The preview is "moved":
|
I am confident on the new code, applied to the newer release. |
I've had a play and it looks good to me. Thanks! I am interested in making the preview work correctly with Asciidoctor includes at some stage and will raise an issue for this. I'm playing around with some ways to do this. |
It would be great if the preview jumped to the modified location if it is out of view. Similarly it would be really nice if the editor could be scrolled to a certain position by e.g. double clicking in the preview. Similar features are implemented in the
Brackets
editor for asciidoc, but I haven't seen it in any other editor/preview plugin.The text was updated successfully, but these errors were encountered: