GithubHelp home page GithubHelp logo

asciidoctor / asciidoctor-vscode Goto Github PK

View Code? Open in Web Editor NEW
315.0 21.0 96.0 92.38 MB

AsciiDoc support for Visual Studio Code using Asciidoctor

License: Other

TypeScript 78.11% CSS 18.86% JavaScript 1.95% Shell 0.57% PowerShell 0.16% AppleScript 0.35%
vscode-extension vscode asciidoc asciidoctor hacktoberfest

asciidoctor-vscode's Introduction

AsciiDoc support for Visual Studio Code

Version Installs Ratings Project chat

An extension that provides live preview, syntax highlighting and snippets for the AsciiDoc format using Asciidoctor.

demo

How to Install

Launch Visual Studio Code "Quick Open" (Ctrl+P), paste the following command, and press Enter:

ext install asciidoctor.asciidoctor-vscode

Alternatively, you can use the built-in extension browser to find the AsciiDoc by asciidoctor extension and install it.

This extension is also available as a pre-version (alpha) in Visual Studio Code for the Web and can be installed using the same procedure.

Feature Desktop Web
Document Outline and Symbols ✔️ ✔️
Equations (via Mathjax) ✔️ ✔️ (requires security to be disabled)
Export as PDF ✔️
Kroki Integration for Diagrams ✔️ ✔️
Paste Image ✔️
Save as HTML ✔️
Save as DocBook ✔️
Snippets ✔️ ✔️
Syntax Highlighting ✔️ ✔️ (requires security to be disabled)
Sync scrolling between the editor and the preview ✔️ ✔️

How to Use

The extension activates automatically when opening an AsciiDoc file (.adoc, .ad, .asc, .asciidoc).

Preview

To show the preview you can use the same commands as the Markdown extension:

  • Toggle Preview - ctrl+shift+v (Mac: cmd+shift+v)
  • Open Preview to the Side - ctrl+k v (Mac: cmd+k v)

The extension updates automatically the preview but it can also be forced with the AsciiDoc: Refresh Preview command.

The preview supports setting AsciiDoc attributes through the asciidoc.preview.asciidoctorAttributes setting.

By default, the preview uses VS Code editor theme (workbench.colorTheme). To use Asciidoctor default style set the asciidoc.preview.useEditorStyle setting to false. It is possible to set your own preview stylesheet with the asciidoc.preview.style setting.
It is also possible to define custom templates with the asciidoc.preview.templates setting.
(See more details under Extension Settings)

Export as PDF

The extension provides a quick command to export your AsciiDoc file as PDF.

  • Open the command palette - ctrl+shift+p or F1 (Mac: cmd+shift+p)
  • Select AsciiDoc: Export document as PDF
  • Choose the folder and filename for the generated PDF

By default, the PDF export feature relies on asciidoctor-pdf. If you prefer to use wkhtmltopdf, set the asciidoc.pdf.engine setting to wkhtmltopdf and configure the asciidoc.pdf.wkhtmltopdfCommandPath if necessary.
(See more details under Extension Settings)

Save as HTML

The extension provides a quick command to export your AsciiDoc file as HTML using the default Asciidoctor stylesheet.

  • Open the command palette - ctrl+shift+p or F1 (Mac: cmd+shift+p)
  • Select AsciiDoc: Save HTML document
  • The file is generated in the same folder as the source document

The shortcut key of ctrl+alt+s (Mac: cmd+alt+s) will also save the document.

Save to Docbook

The extension provides a quick command to export your AsciiDoc file as DocBook.

  • Open the command palette - ctrl+shift+p or F1 (Mac: cmd+shift+p)
  • Select AsciiDoc: Save to DocBook
  • The file is generated in the same folder as the source document

ℹ️ Note: Only DocBook 5 is supported.

Snippets

Several code snippets are provided including but not limited to: include statements, images, links, header, headings, lists, blocks, etc...

For a full list open the command palette and select Insert Snippet.

Identifying the VS Code Environment

The env-vscode attribute is set on all output documents. If you need to identify or handle the VS Code environment you can use an ifdef expression similar to the following:

ifdef::env-vscode[]
This is for vscode only
endif::[]

Diagram Integration

This extension supports a wide range of diagrams from BPMN to Graphviz to PlantUML and Vega graphs using Kroki and asciidoctor-kroki.

You can see the full range on the Kroki website.

Note that this extension will send graph information to https://kroki.io. If this is an issue it is also possible to use your own Kroki instance (see the instructions for further information).

To enable diagram support, set the asciidoc.extensions.enableKroki setting to true.

❗ Important: Please note that :kroki-fetch-diagram: is currently not supported because it relies on unxhr which does not work in VS Code (ggrossetie/unxhr#98).

Use Asciidoctor.js extensions

When using the preview, the VS Code extension can load and register Asciidoctor.js extensions.

By convention, extensions must be located in .asciidoctor/lib (at the root of your workspace). The VS Code extension will recursively load all files with the extension .js as Asciidoctor.js extensions. For instance, the following files will be loaded: .asciidoctor/lib/emoji.js, .asciidoctor/lib/emoji/index.js and .asciidoctor/lib/foo/bar/baz.js.

To use an Asciidoctor.js extension, you should enable the feature by checking "Enable Asciidoctor.js extensions registration" in the extension settings. The first time, you will also need to confirm that you trust the authors of the Asciidoctor.js extensions located in .asciidoctor/lib.

Asciidoctor.js extensions trust confirmation message

❗ Important: This feature will execute JavaScript code and should not be enabled if you don't fully trust the authors of the Asciidoctor.js extensions.

💡 Tip: You can always update the trust mode using the command "Manage Asciidoctor.js Extensions Trust Mode".

You can create a new extension by creating a JavaScript file in the .asciidoctor/lib directory or use an existing one. Here's an example of how to use the asciidoctor-emoji extension:

  1. Install the npm package in the workspace directory:

    npm i asciidoctor-emoji
  2. Create a file a JavaScript file in .asciidoctor/lib with the following content:

    module.exports = require('asciidoctor-emoji')
  3. Enjoy 🎉

Asciidoctor.js Emoji extension enabled!

Asciidoctor Config File

To provide a common set of variables when rendering the preview, the extension reads an .asciidoctorconfig or .asciidoctorconfig.adoc configuration file. Use this to optimize the preview when the project contains a document that is split out to multiple include-files.

It is inspired by the implementation provided in IntelliJ AsciiDoc Plugin and reused in Eclipse AsciiDoc plugin.

Extension Settings

This extension contributes the following settings:

Preview

Name Description Default Value
asciidoc.preview.asciidoctorAttribute Asciidoctor attributes used in the preview (object of {string: string}). {}
asciidoc.preview.refreshInterval Interval in milliseconds between two consecutive updates of the preview. The value 0 means it will only update the preview on save. 2000
asciidoc.preview.style An URL or a local path to CSS style sheets to use from the preview.
asciidoc.preview.useEditorStyle Use VS Code editor style instead of the default Asciidoctor style.
asciidoc.preview.fontFamily Control the font family used in the preview. "-apple-system, BlinkMacSystemFont, 'Segoe WPC', 'Segoe UI', 'HelveticaNeue-Light', 'Ubuntu', 'Droid Sans', sans-serif"
asciidoc.preview.fontSize Control the font size in pixels used in the preview. 14
asciidoc.preview.lineHeight Control the line height used in the preview. 1.6
asciidoc.preview.scrollPreviewWithEditor When the preview is scrolled, update the view of the editor. true
asciidoc.preview.scrollEditorWithPreview When the editor is scrolled, update the view of the preview. true
asciidoc.preview.markEditorSelection Mark the current editor selection in the preview. true
asciidoc.preview.doubleClickToSwitchToEditor Double click in the preview to switch to the editor. true
asciidoc.preview.preservePreviewWhenHidden Keep the AsciiDoc preview in memory when it's hidden so that it reloads faster, at the expense of increased memory use. false
asciidoc.preview.openLinksToAsciidocFiles Control how links to other AsciiDoc files in the preview should be opened. Possible values: "inPreview", "inEditor". "inPreview"

PDF

Name Description Default Value
asciidoc.pdf.engine Control the PDF engine used to export as PDF. Possible values: "asciidoctor-pdf", "wkhtmltopdf". "asciidoctor-pdf"
asciidoc.pdf.asciidoctorPdfCommandPath External asciidoctor-pdf command to execute. It accepts a full path to the binary, for instance: /path/to/asciidoctor-pdf. "bundle exec asciidoctor-pdf"
asciidoc.pdf.asciidoctorPdfCommandArgs List of arguments, for instance: -a, pdf-themesdir=resources/themes, -a, pdf-theme=basic. Please note that the argument key and value should be added separately (i.e., two items). By default, it passes the following arguments: --quiet and --base-dir with the full directory path to the AsciiDoc document. []
asciidoc.pdf.wkhtmltopdfCommandPath External wkhtmltopdf command to execute. It accepts a full path to the binary, for instance: /path/to/wkhtmltopdf. If the value is empty, use either wkhtmltopdf on Linux/macOS or wkhtmltopdf.exe on Windows. ""
asciidoc.pdf.wkhtmltopdfCommandArgs List of arguments, for instance: --orientation, Landscape. Please note that the argument key and value should be added separately (i.e., two items). By default, it passes the following arguments: --enable-local-file-access, --encoding, utf-8, --javascript-delay, 1000, --footer-center (if enabled) and cover (if it has a cover page). []

Extensions

Name Description Default Value
asciidoc.extensions.enableKroki Enable Kroki extension to generate diagrams. false
asciidoc.extensions.registerWorkspaceExtensions Enables Asciidoctor.js extensions registration from the workspace directory .asciidoctor/lib. false

General

Name Description Default Value
asciidoc.useWorkspaceRootAsBaseDirectory When in a workspace, use the workspace root path as the base directory. false

Debug

Name Description Default Value
asciidoc.debug.trace Enable debug logging for this extension. Possible values: "off", "verbose". "off"
asciidoc.debug.enableErrorDiagnostics Provide error diagnostics. true

Build and Install from Source

Manual

git clone https://github.com/asciidoctor/asciidoctor-vscode
cd asciidoctor-vscode
npm install
npm run package
code --install-extension *.vsix

Issues

If you encounter any problems with the extension and cannot find the solution yourself, please open an issue in the dedicated GitHub page: asciidoctor-vscode/issues.

Before opening an issue, please make sure that it is not a duplicate. Your problem may have already been brought up by another user and been solved: asciidoctor-vscode/issues all.

When you do open an issue, remember to include the following information:

  1. Description of the issue
  2. VSCode version, OS (Help -> About) and extension version
  3. Steps to reproduce the issue
    IMPORTANT: We cannot solve the issue if you do not explain how you encountered it
  4. If the problem occurs only with a specific file, attach it, together with any screenshot that might better show what the issue is.

If your issue only appeared after updating to a new version of the extension, you can roll back to a previous one via the extensions browser. Click on the small gear icon beside the AsciiDoc extension, then select Install Another Version.... A selection menu will appear allowing you to select which version you want to install.

Contributing

To contribute simply clone the repository and then commit your changes. When you do a pull request please clearly highlight what you changed in the pull comment.

Do not update the extension version or changelog, it will be done by the maintainers when a new version is released.

If you want to update the readme, you are free to fix typos, errors, and add or improve descriptions; but, if you have a style change in mind please use an issue (or specific pull request) so that it can be discussed.

Credits

asciidoctor-vscode's People

Contributors

anb0s avatar apupier avatar cirrusj avatar d-koppenhagen avatar danyill avatar dependabot[bot] avatar dimeiza avatar eiswind avatar gdamore avatar ggrossetie avatar jacksoncougar avatar joaompinto avatar jstafman avatar larshp avatar marekr avatar marieflorescontact avatar mariotoffia avatar matteocampinoti94 avatar meznom avatar mojavelinux avatar nicerloop avatar oey avatar ptensschi avatar rben01 avatar rongcuid avatar s0lvang avatar spegoraro avatar thepollard avatar vitoni avatar yoshihideshirai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asciidoctor-vscode's Issues

"Operation not permitted" using previewToSide when not Administrator (Windows)

Windows 7
VS Code: 1.11.2
AsciiDoctor: 0.3.3

Reproduce:

  1. Start VS Code as non-administrator

  2. Change empty file type to AsciiDoc

  3. Use command adoc.previewToSide

This gives an error like the following:

Unable to open '\Preview: 'Untitled-1'': EPERM: operation not permitted, open 'C:\Program Files (x86)\Microsoft VS Code\tmp-6068uPBApv0Y5nNQ.adoc'.

Error on rendering when switching between multiple adocs

Another scenario that results in the error popup: "Unable to open '/Preview: 'filename.adoc'': Cannot read property 'document' of undefined.":

open the sample document provided above in VScode and display the adoc-Preview
open a copy of the same document in the same instance of VScode and display the adoc-Preview
switch back to the tab of the first document

Errors with stdout maxbuffer

Hello!

I have .adoc file with 1000+ lines. I added new attribute to this document :data-uri:. After that I got the following error:

stdout maxBuffer exceeded Error: stdout maxBuffer exceeded at Socket.onChildStdout
 (child_process.js:270:14) at emitOne (events.js:96:13) at Socket.emit (events.js:191:7) at 
readableAddChunk (_stream_readable.js:178:18) at Socket.Readable.push (_stream_readable.js:136:10)
 at Pipe.onread (net.js:560:20)

Now I just use asciidoctor -a data-uri mydoc.adoc unstead.

How can I make this buffer bigger?

Best regards,
Andrey.

Possible regression: image preview no longer working as before

I just installed the latest AsciiDoc in Code (0.3.1), and now the images links are broken in preview.

In my file:

:imagesdir: images is at the top

image:059_01_Couchbase_Web_Console.png[Couchbase Web Console login] is later in the post

And in the preview:

2017-03-17 10_11_21-blogpost adoc - groves - visual studio code

Am I doing something wrong, or is this a regression?

Literal HTML not showing YouTube videos

This is a minor thing, but when I'm using literal HTML AsciiDoc code to embed a YouTube video, the YouTube video does not show in the preview.

Example:

+++

<iframe width="560" height="315" src="https://www.youtube.com/embed/mor2p0UqZ14" frameborder="0" allowfullscreen></iframe>

+++

It shows a gap where the video would be, but it doesn't show the video.

Use the same keybinds as the markdown extension.

	"keybindings": [
		{
			"command": "markdown.showPreview",
			"key": "shift+ctrl+v",
			"mac": "shift+cmd+v",
			"when": "editorLangId == markdown"
		},
		{
			"command": "markdown.showPreviewToSide",
			"key": "ctrl+k v",
			"mac": "cmd+k v",
			"when": "editorLangId == markdown"
		}

],

Rebase to the markdown extension code base

While planning for #11 I have noted that most of the VSCode markdown features make sense for asciidoc. As such, it will be more efficient/productive/maintainable to reuse as much as possible from the markdown code base, adapting just what is required for the different render engine (asciidoctor.js replacing markdown-it)

https://github.com/Microsoft/vscode/tree/master/extensions/markdown-language-features

Because this is a major feature/change, it will be worked in a new branch:
https://github.com/joaompinto/asciidoctor-vscode/tree/markdown-rebase

command 'adoc.previewToSide' not found

I installed and reinstalled the extension asciidoc-vscode for my code editor.

I opened my txt file which as my asciidoc markings.

When I try to do
AsciiDoc: Open Preview to the Side

or

AsciiDoc: Toggle Preview

I get the following error and nothing happens.

command 'adoc.previewToSide' not found

Is there something I am doing wrong ?

Please advise.

Problems installing the plugin

Hi all,
I have a problem installing the asciidoctor plugin in vscode on my mac.

Im using:

  • macOS Sierra 10.12.6
  • vscode 1.21

When installing the plugin with the installer the installation seems to run fine. I can see the commands of the plugin:

image

But when I select one of those commands I receive the following error messages:

image
or
image

Therefore I removed the plugin and executed the installation like described in the marketplace:

git clone https://github.com/joaompinto/asciidoctor-vscode
cd asciidoctor-vscode
npm install
sudo npm install -g vsce typescript
vsce package
code --install-extension *.vsix

When executing:

vsce package
I receive another error message:

Executing prepublish script 'npm run vscode:prepublish'...
Error: Command failed: npm run vscode:prepublish
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] vscode:prepublish: `tsc -p ./`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] vscode:prepublish script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/.../.npm/_logs/2018-03-15T20_37_31_295Z-debug.log

And in this log I can find the following information:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/Cellar/node/9.8.0/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'vscode:prepublish' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prevscode:prepublish',
4 verbose run-script   'vscode:prepublish',
4 verbose run-script   'postvscode:prepublish' ]
5 info lifecycle [email protected]~prevscode:prepublish: [email protected]
6 info lifecycle [email protected]~vscode:prepublish: [email protected]
7 verbose lifecycle [email protected]~vscode:prepublish: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~vscode:prepublish: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/.../programs/asciidoctor-vscode/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/.../arcanist/arcanist/bin/
9 verbose lifecycle [email protected]~vscode:prepublish: CWD: /Users/.../programs/asciidoctor-vscode
10 silly lifecycle [email protected]~vscode:prepublish: Args: [ '-c', 'tsc -p ./' ]
11 silly lifecycle [email protected]~vscode:prepublish: Returned: code: 2  signal: null
12 info lifecycle [email protected]~vscode:prepublish: Failed to exec vscode:prepublish script
13 verbose stack Error: [email protected] vscode:prepublish: `tsc -p ./`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack     at EventEmitter.emit (events.js:180:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:180:13)
13 verbose stack     at maybeClose (internal/child_process.js:936:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/.../programs/asciidoctor-vscode
16 verbose Darwin 16.7.0
17 verbose argv "/usr/local/Cellar/node/9.8.0/bin/node" "/usr/local/bin/npm" "run" "vscode:prepublish"
18 verbose node v9.8.0
19 verbose npm  v5.6.0
20 error code ELIFECYCLE
21 error errno 2
22 error [email protected] vscode:prepublish: `tsc -p ./`
22 error Exit status 2
23 error Failed at the [email protected] vscode:prepublish script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

Do you have any Idea why the installation of your plugin does not work for me?
Thank you!
regards
Christian

Error when handling large docs

I have rather large adoc which can be processed because the output of the asciidoctor program exceeds some buffer value:

Error

stdout maxBuffer exceeded Error: stdout maxBuffer exceeded at Socket. (child_process.js:271:14) at emitOne (events.js:96:13) at Socket.emit (events.js:188:7) at readableAddChunk (_stream_readable.js:176:18) at Socket.Readable.push (_stream_readable.js:134:10) at Pipe.onread (net.js:543:20)

Support includes in preview and preview synchronisation

When a document has includes a bunch of files, changing location in the source document does not align in the preview. This is a pretty cool feature of Asciidoc and supporting it in this extension is a worthy (but non-trivial goal).

What should be the correct behaviour?

One option:

  1. With a preview of the "main" document, the line numbers should align correctly when the user scrolls in the source.
  2. If while the preview of the "main" document is open and an "included" file is opened, then the preview should scroll to the appropriate location in the included file.

I'm looking into doing this by writing a "data-line" and "data-file" attribute to the output. Information for both of these are available when sourcemap is set on asciidoctor. This is semantically better than the current solution of putting a role with the line number in (which is hard to do with the file name without doing weird stuff) but requires the use of templates and converters. I'm not sure whether a better approach is possible.

Asciidoctor.js does not allow includes

With the new default of using Asciidoctor.js, includes don't function correctly:

Without:

"AsciiDoc.use_asciidoctor_js": false,

The following occurs for an include outside the current directory:

Unresolved directive in <stdin> - include
:../assets/attributes-include.adoc[]

There is some discussion of this error in node environments here:

asciidoctor/asciidoctor.js#42

It does not seem to mattere if I use unsafe mode with the following in my settings:

"AsciiDoc.html_generator": "asciidoctor  --safe-mode=unsafe -o-",

Or whether the file is in the same directory or above it.
I wonder/suspect these options may not be passed to asciidoctor.js?

Wrong preview after opening new .adoc file

When I open a folder and work on one .adoc file and open the live preview everything works fine.
When I switch to another .adoc file in the same project (not even necessarily in the same sub-dir) the preview window remains showing the original .adoc preview.
The title of the preview window matches the open .adoc file that I wanted a preview of, but it is the wrong document.
Occassionally CMD+W on the windows will allow it to correct, but usually I have to exit/restart VSCode.
On Mac 10.12.5
VSCode 1.13.1
AsciiDoc Live Preview extension v0.3.3

Preview fails with error (unable to open \Preview)

In VS Code on Windows, when trying to turn on the preview with:

  • Open Preview to the Side
  • or: Toggle Preview

it shows the error:

Unable to open '\Preview: 'README.asciidoc'': Error

Any ideas what could be going wrong, or how to troubleshoot this?

error-aciidoc-vscode

Thanks,
--Neno

Regression, open asciidoc preview now overrides existing previews with same file

I fixed this in my previous pull request #21 but somewhere in the last few versions it broke again. (Using 0.3.7 now)

If you open a preview on one file, and then go to open a preview on a second file at the same time. Both previews update to the new file.

Really ruins my workflow SIGH.

This could be the fault of VSCode as the VSCode devs have a stick up their ass pretending they aren't breaking the extension api every release.

Enable surrounding for bold, italic, subscript, superscript, etc

Hi,

I'd like to know if there'd be anything against adding *, _, ~, ^ and # to surroundingPairs, so we can just select part of a text and make it bold, italic, etc.

Formatting parts of a word (by using, say double **aster**isks) is automatically supported if you just select the part of the word and press asterisk twice.

I've edited my version of your extension and am currently playing with it, and it seems to work. I'll send a pull request if you want to try it.

Thank you!

Regression: styling with asciidoctor.js

I am intermittently on both Linux and Windows getting a different display of my document using Asciidoctor.js.

I get a dark background and much smaller text than usual. See below for instance:

image

Preview jumps back to top a lot

I just started using this today, and I really like it.

Except that I noticed the preview seems to jump back to the top on its own too often. So I have to spend a lot of time scrolling back to what I was working on. Is there something I can do to turn off the auto-scrolling completely?

asciidoctor is run too often

It's great to see some asciidoctor support in VSCode!

I am using VSCode 1.15.1 with v0.3.5 of this plugin on OSX. It seems that asciidoctor is run on every keystroke on a temp file, and this behavior can easily overwhelm even a powerful computer when the cursor is on a rapid movement because every keystroke launches a new instance of asciidoctor.

Aside from not running asciidoctor on non-editing keys (i.e., not on cursor movements) and not running multiple instances of asciidoctor simultaneously, I wish to see options like:

  • run on save only
  • run on temp file like it is today, but no more frequently than say (a default of) 5 seconds

Thank you!

Cannot move preview tab to a separate window

VSC

Version 1.10.2
Commit 8076a19fdcab7e1fc1707952d652f0bb6c6db331
Date 2017-03-08T14:02:52.799Z
Shell 1.4.6
Renderer 53.0.2785.143
Node 6.5.0

OS

Windows 7 x64

Steps to Reproduce

  1. Open two separate windows
  2. Open asciidoctor document with a preview tab
  3. Drag the a preview tab from one window to the tab bar in the other window
  4. Nothing happens? I would expect this to move the tab to the window I just dragged it to

Preview crashes after click on link

STR:

  1. Create document with TOC or image thumbnail
  2. Open preview
  3. Click on link

Expected:
Follow a link

Given:
Preview document closes, error popups: "Unable to open '/Preview: 'filename.adoc'': Cannot read property 'document' of undefined."
Preview stops working till restart of an application.

VScode version: Version 1.10.1, 653f8733dd5a5c43d66d7168b4701f94d72b62e5
plugin version: 0.3.0

Preview updates should be frequency based

Currently the preview html is generated at each document change, this results in huge waste of processing when typing. The preview mechanism should be time based, skipping when there are no changes.

Do not use temporary files for adoc generation

Asciidoctor supports stdin/stdout conversion, the current approach of generating tmp files is not required, and in some rare cases can leave lost tmp files in the document source directory.

It is critical to test thins change with:

  • include.adoc with relative paths
  • links with relative paths
    Asciidoctor Ruby / Asciidoctor JS

Support sectnums in symbols and use processed output

Symbols at present are generated by a regex on the source document.

This has two deficiencies:

  1. Does not processing of included files.
  2. Does not allow sectnums or sectnumlevels (see docs)

A good option would be to generate symbols by using the preview and then extract sections from the processed html.

Thoughts? I'll add this to my list of things to look into.

This also has the advantage of handling both setex and atx heading styles in an agnostic fashion (we out-source the complexities to asciidoctor).

The challenge is similar to includes I think we need to produce some kind of object which provides section title, line number and file.

It requires Administrator's priviledge to preview unsaved (untitled) files in Windows

I created a new file, changed the language mode to AsciiDoc, and tried to open the preview of it, but I got the following message and couldn't get the preview:

'\Untitled-1' を開くことができません: EPERM: operation not permitted, open 'C:\Program Files\Microsoft VS Code\tmp-2476CeZ55Mzcku7q.adoc'。

i.e.

Cannot open '\Untitled-1': EPERM: operation not permitted, open 'C:\Program Files\Microsoft VS Code\tmp-2476CeZ55Mzcku7q.adoc'.

This was reproduced on my notebook (Windows 10 + VSCode 1.19.2 + Ruby 2.5.0 + Asciidoctor 1.5.6.1 + Asciidoctor PDF 1.5.0.alpha.16), but not reproduced on my desktop for research (Ubuntu 17.10 + VSCode 1.19.2 + Ruby 2.3.3 + Asciidoctor 1.5.5 + Asciidoctor PDF 1.5.0.alpha.16).

However, it didn't occurred when VSCode was opened with the Administrator's p;riviledge.

can not open preview to the Side

error messge:
can not open “\Preview: 'test.adoc'”: Cannot read property 'document' of undefined。

windows, vscode version 1.8, portable version

Unable to open 'Preview 'test.adoc'': Error

% asciidoctor --version
Asciidoctor 1.5.6.1 [http://asciidoctor.org]
Runtime Environment (ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]) (lc:UTF-8 fs:UTF-8 in:- ex:UTF-8)

Gentoo Linux

VS Code 1.15.1

command 'adoc.previewToSide' not found

When I click Open Preview to the Side [Ctd+K V] it says

command 'adoc.previewToSide' not found

However, when I use the shortcut key Ctd+K V it works.

Cannot install extension from source

following the instructions with the addition of installing typescript globally:

git clone https://github.com/joaompinto/asciidoctor-vscode
cd asciidoctor-vscode
npm install
sudo npm install -g vsce typescript
vsce package
code --install-extension *.vsix

I get an error when running vsce package:

vsce package
Executing prepublish script 'npm run vscode:prepublish'...
Error: Command failed: /bin/sh -c npm run vscode:prepublish

npm ERR! Linux 4.13.4-041304-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "vscode:prepublish"
npm ERR! node v4.7.2
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! [email protected] vscode:prepublish: `tsc -p ./`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] vscode:prepublish script 'tsc -p ./'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the asciidoctor-vscode package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     tsc -p ./
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs asciidoctor-vscode
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls asciidoctor-vscode
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     vstest/asciidoctor-vscode/npm-debug.log

Running this command standalone in the shell:

tsc -p ./
src/AsciiDocProvider.ts(129,23): error TS2559: Type '(error: Error, stdout: Buffer, stderr: Buffer) => void' has no properties in common with type 'ExecOptions'.

A node version problem? My system:

vstest/asciidoctor-vscode$ uname -a
Linux XPS-13-9360 4.13.4-041304-generic #201709270931 SMP Wed Sep 27 13:35:03 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
vstest/asciidoctor-vscode$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 17.04
Release:        17.04
Codename:       zesty

Any assistance appreciated

Add support for location synchronization between editor and preview

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.

Buffer size

I very often get this on large Asciidoc files, particularly when I embedding in graphics.

Error

stdout maxBuffer exceeded Error: stdout maxBuffer exceeded at Socket.onChildStdout (child_process.js:270:14) at emitOne (events.js:96:13) at Socket.emit (events.js:191:7) at readableAddChunk (_stream_readable.js:178:18) at Socket.Readable.push (_stream_readable.js:136:10) at Pipe.onread (net.js:560:20) 

If the asciidoctor binary is not in your PATH, you can set the full path.
Go to `File -> Preferences -> User settings` and adjust the AsciiDoc.html_generator config option.

I fairly frequently get this error.

Suggest the stdout maxBuffer parameter be added to the configuration to give some flexibility here. I'll do a PR for this.

Broken on VSCode 1.11.0

Attempting to open a preview window on 1.11.0 causes a error.

"Cannot read property 'document' of undefined."

This is probably due to the new workspaces feature. Really sucks how VSCode can't maintain API compatibility worth a damn due to JS land.

Please don't use Ctrl-K for previewing

Ctrl-K is by default bound to deleting all right on VSCode on Mac (and maybe other platforms). This extension is great but please don't hide the default Ctrl-K with the previewing shortcut.

Syntax highlighting breaks with # in source code mode (line indented)

Exemple:
Install RVM along with the latest version of Ruby:

$ curl -#L https://get.rvm.io | bash -s stable --autolibs=3 --ruby 

RVM will download and build the Ruby language.

Asciidoctor ignores a # in source code mode (indenting lines), however the syntax highlighter expexts a closing #, but doesn't find it.

Problem with scopes

It looks like there is a problem with the detection for __git_ps1 and other underscores within back ticks.

This is what my code snippet looks like with __git_ps1 in it.

image

If I escape the underscores, the highlighting goes back to normal.

image

However, the escaping characters are then printed, since code is rendered as-is
image

Asciidoctor-vscode 0.3.3 won't install OS X 10.12.5 VSC 1.12.2

Both via the GUI and the cmd-line it won't install. cmd-line more helpful. Following these steps:

git clone https://github.com/joaompinto/asciidoctor-vscode
cd asciidoctor-vscode
npm install
sudo npm install -g vsce
vsce package
code --install-extension *.vsix

I get:

[ { Error: ENOENT: no such file or directory, open '/Users/tok/.vscode/extensions/joaompinto.asciidoctor-vscode-0.3.3/package.json'
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/Users/tok/.vscode/extensions/joaompinto.asciidoctor-vscode-0.3.3/package.json' } ]

Now if I copy the package.json file in manually, I still get the same issue. I assume because code --install-extension *.vsix removes Users/tok/.vscode/extensions/joaompinto.asciidoctor-vscode-0.3.3 and starts over from scratch.

Vexing. FWIW this problem didn't manifest itself until I installed various other bits of the the whole asciidoc world (ascidoctor, plus some alignedstuff such as dblatex)

Preview for inter document cross reference

From Asciidoctor's User Manual

= Document Title
ifdef::env-github,env-browser[:outfilesuffix: .adoc]

See the <<README#,README>>.

We could also write the link as link:README{outfilesuffix}[README].

The links in the generated document will now point to README.adoc instead of the default, README.html.

It is supported in asciidoctor-vscode?

Stylesheet

Do I need to do anything special to add a stylesheet?

:stylesheet: css/mycss.css

Mathjax doesn't work

Hello!

VS studio version 1.19.0 Insider.

I tried to type any formula, for example, stem::[\sin(x)], but see only \$\sin(x)\$. It seems for me, that mathjax isn't running for me.

How can I fix this? I restarted my vs code, but this didn't help me. Internet works fine.

Best regards,
Andrey.

Alt + click to follow link broken

https://github.com/[First word] leads to https://github.com/[First as link. Can VSCode be instructed to make the link parsing syntax dependent?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.