Comments (10)
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.
from asciidoctor-vscode.
+1
from asciidoctor-vscode.
wish
from asciidoctor-vscode.
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
- I think we need to run Asciidoctor with
sourcemap=true
- We then call
find_by
which returns all nodes - We then iterate across these and call
source_location().line_no
or similar. We then manipulate the object model to add this information. - @rahmanusta has implemented a TreeProcessor (thanks!) which may be very similar to what is needed here in AsciidocFX which adds the line number to the role.
from asciidoctor-vscode.
@danyill thanks for the research, I was not aware of the sourcemap option.
The markdown built-in extension already provides this functionality (https://github.com/Microsoft/vscode/blob/master/extensions/markdown-language-features/src/markdownEngine.ts#L112) .
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.
from asciidoctor-vscode.
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 :)
from asciidoctor-vscode.
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.
from asciidoctor-vscode.
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":
- When text is changed
- When text is selected
from asciidoctor-vscode.
I am confident on the new code, applied to the newer release.
from asciidoctor-vscode.
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.
from asciidoctor-vscode.
Related Issues (20)
- Add Ability to Run Antora on Playbook .yml Files from VSCODE GUI (Right-Click > Launch Antora)? HOT 3
- Antora support prompt always appears unexpectedly in a Git workspace HOT 20
- Consistent code completion for includes HOT 5
- Find templates automatically under .asciidoctor/templates HOT 5
- Improve antora experience by putting a doc div into generated preview html HOT 9
- Unable to preview resources (images, css...) outside of the workspace 401 Unauthorized HOT 9
- ToC placement "preamble" / "macro" forces white background for ToC HOT 1
- Preview render is fixed width HOT 6
- Increase preview rendering speed HOT 2
- Syntax Highlighting doesn't work in preview HOT 8
- add imagesdir setting in asciidoctor attributes when antora is enable HOT 7
- Test "Antora support with single documentation component" is flaky HOT 1
- Preview stops working if reference to bibliography entry exists in 3.2.1 HOT 5
- `npm install` reports 9 vulnerabilities on `master` HOT 1
- Quotes have a dark overlay in preview but not in .pdf HOT 4
- `package.json` and `package-lock.json` are not in sync after `prepare branch for development [no ci]` HOT 2
- Add test coverage reporting
- Project README / CHANGELOG is Markdown instead of AsciiDoc
- Asciidoc: Export Document as PDF --> prompts user every time HOT 1
- Preview scroll offset wrong when includes are used HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asciidoctor-vscode.