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)
- 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
- Make error more prominent
- Preview scroll offset wrong when working with tables HOT 1
- Disabling SSL verification HOT 2
- Syntax highlighting broken if a variable is used with bash source
- Preview not rendering checkboxes in checklist
- Ctrl + Alt + V break HOT 1
- [Windows Only][Antora Support] `include::example$something` not working on windows
- Cant use asciidoctor in my own extension as soon as i active asciidoctor-vscode extension HOT 7
- Antora preview doesn't work if version is not specified in antora.yml
- Callout and Syntax Highlighting in code blocks
- Right-click causes incorrect multi-select behavior HOT 3
- xrefstyle is not honored when displaying xrefs HOT 2
- Table display issue
- [Feature Request] Point asciidoc.preview.asciidoctorAttributes to file which holds attributes HOT 2
- Verse delimited block syntax breaks syntax highlighting. HOT 1
- Section syntax highlighting stop working when adding extra space to a table separator (`|== `) HOT 2
- reduce frequency of antora support prompt 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.