• Stars
    star
    281
  • Rank 147,023 (Top 3 %)
  • Language
    TypeScript
  • License
    Other
  • Created about 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

AsciiDoc support for Visual Studio Code using Asciidoctor

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.

To cache and save diagrams locally set the :kroki-fetch-diagram: AsciiDoc attribute in your document header:

= My Amazing Document
:kroki-fetch-diagram:

This will store images by default in your document folder, however you may also set imagesdir to store them elsewhere:

= My Amazing Document
:kroki-fetch-diagram:
:imagesdir: media

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

More Repositories

1

asciidoctor

💎 A fast, open source text processor and publishing toolchain, written in Ruby, for converting AsciiDoc content to HTML 5, DocBook 5, and other formats.
Ruby
4,437
star
2

asciidoctor-pdf

📃 Asciidoctor PDF: A native PDF converter for AsciiDoc based on Asciidoctor and Prawn, written entirely in Ruby.
Ruby
1,089
star
3

asciidoctor.js

📜 A JavaScript port of Asciidoctor, a modern implementation of AsciiDoc
JavaScript
664
star
4

asciidoctorj

☕ Java bindings for Asciidoctor. Asciidoctor on the JVM!
Java
593
star
5

asciidoctor-diagram

↔️ Asciidoctor diagram extension, with support for AsciiToSVG, BlockDiag (BlockDiag, SeqDiag, ActDiag, NwDiag), Ditaa, Erd, GraphViz, Mermaid, Msc, PlantUML, Shaape, SvgBob, Syntrax, UMLet, Vega, Vega-Lite and WaveDrom.
Ruby
434
star
6

asciidoctor-intellij-plugin

AsciiDoc plugin for products on the IntelliJ platform (IDEA, RubyMine, etc)
Java
324
star
7

asciidoctor.org

🌐 Asciidoctor project site. Composed in AsciiDoc. Baked with Awestruct.
SCSS
308
star
8

asciidoctor-maven-plugin

A Maven plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
Java
298
star
9

jekyll-asciidoc

💉 A Jekyll plugin that converts AsciiDoc source files in your site to HTML pages using Asciidoctor.
Ruby
298
star
10

docker-asciidoctor

🚢 A Docker image for using the Asciidoctor toolchain to process AsciiDoc content
Shell
294
star
11

asciidoctor-gradle-plugin

A Gradle plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
Groovy
272
star
12

asciidoctor-reveal.js

🔮 A reveal.js converter for Asciidoctor and Asciidoctor.js. Write your slides in AsciiDoc!
HTML
270
star
13

asciidoctor-epub3

📘 Asciidoctor EPUB3 is a set of Asciidoctor extensions for converting AsciiDoc to EPUB3 & KF8/MOBI
Ruby
203
star
14

asciidoctor-browser-extension

⚪ An extension for web browsers that converts AsciiDoc files to HTML using Asciidoctor.js.
CSS
202
star
15

asciidoctor-maven-examples

A collection of example projects that demonstrates how to use the Asciidoctor Maven plugin.
Java
187
star
16

asciidoctor-stylesheet-factory

!DEPRECATED! This was the utility project for producing the default stylesheet for the HTML converter in Asciidoctor. The source of the default stylesheet now lives in the main Asciidoctor repository.
SCSS
178
star
17

kramdown-asciidoc

A kramdown extension for converting Markdown documents to AsciiDoc.
Ruby
174
star
18

asciidoctor-gradle-examples

A collection of example projects that demonstrates how to use the Asciidoctor Gradle plugin
Java
145
star
19

atom-asciidoc-preview

⚛ AsciiDoc preview for the Atom editor.
CoffeeScript
142
star
20

asciidoctor-kroki

Asciidoctor.js extension to convert diagrams to images using Kroki!
JavaScript
124
star
21

asciidoclet

📋 A Javadoc Doclet based on Asciidoctor that lets you write Javadoc in the AsciiDoc syntax.
Java
120
star
22

asciidoctor-fopub

A portable DocBook-to-PDF build command that wraps DocBook XSL and Apache FOP
Java
111
star
23

asciidoctor-latex

📐 Add LaTeX features to AsciiDoc & convert AsciiDoc to LaTeX
Ruby
106
star
24

jekyll-asciidoc-quickstart

A template project for creating AsciiDoc-based websites using Jekyll.
CSS
105
star
25

asciidoctor-extensions-lab

A lab for testing and demonstrating Asciidoctor extensions. Please do not use this code in production. If you want to use one of these extensions in your application, create a new project, import the code, and distribute it as a RubyGem. You can then request to make it a top-level project under the Asciidoctor organization.
Ruby
97
star
26

asciidoctor-confluence

Push Asciidoctor file to Confluence
Ruby
80
star
27

asciidoctor-backends

Backends (i.e., templates) for Asciidoctor, a Ruby port of AsciiDoc.
HTML
66
star
28

asciidoctor-bibtex

Add bibtex citation support for asciidoc documents
Ruby
59
star
29

docgist

Render AsciiDoc documents from Gists, GitHub, DropBox and other remote sources in the browser.
CSS
56
star
30

asciidoc-docs

The source files in this repository served as the initial contribution for the AsciiDoc Language specification project at Eclipse. This repository is now archived.
55
star
31

brackets-asciidoc-preview

Live Preview of AsciiDoc for Adobe Brackets
JavaScript
51
star
32

asciidoctor-bespoke

🅱️ An Asciidoctor converter that generates the HTML component of a Bespoke.js presentation from AsciiDoc.
Slim
49
star
33

sublimetext-asciidoc

AsciiDoc Package for SublimeText 3
Python
49
star
34

asciidoctor-mathematical

An extension for Asciidoctor that converts the content of STEM blocks and inline macros using Mathematical.
Ruby
44
star
35

atom-language-asciidoc

⚛ AsciiDoc language package for the Atom editor.
CoffeeScript
42
star
36

asciidoctorj-pdf

AsciidoctorJ PDF bundles the Asciidoctor PDF RubyGem (asciidoctor-pdf) so it can be loaded into the JVM using JRuby.
Java
33
star
37

asciidoctor-firefox-addon

🐺 An add-on for Mozilla Firefox that converts AsciiDoc files to HTML directly in the browser using Asciidoctor.js.
JavaScript
32
star
38

asciidoctorj-screenshot

A set of AsciidoctorJ extensions for adding automated screenshots to an AsciiDoc document.
Groovy
32
star
39

asciidoctor-tabs

An extension for Asciidoctor that adds a tabs block to the AsciiDoc syntax.
Ruby
29
star
40

asciidoctor-lein-plugin

A Leiningen plugin for generating documentation using Asciidoctor
Clojure
26
star
41

asciidoctor-chart

A set of Asciidoctor extensions that add a chart block and block macro to AsciiDoc for including charts in your AsciiDoc document.
Ruby
25
star
42

asciidoctor-reducer

⚗️ A tool to generate a single AsciiDoc document by expanding all the include directives reachable from the parent document.
Ruby
24
star
43

asciimath

Asciimath parser
Ruby
23
star
44

docbookrx

(An early version of) a DocBook to AsciiDoc converter written in Ruby.
Ruby
22
star
45

gitbucket-asciidoctor-plugin

A GitBucket plug-in that provided AsciiDoc rendering capabilities
Scala
18
star
46

asciidoctor-leanpub-converter

A backend for AsciidoctorJ to generate Leanpub-flavoured Markdown
Groovy
16
star
47

codemirror-asciidoc

AsciiDoc mode for CodeMirror
JavaScript
16
star
48

asciidoc-grammar-prototype

⛔ ARCHIVED: An experiment to create of a formal grammar for the AsciiDoc markup language. Work is being continued at https://github.com/Mogztter/asciidoctor-inline-parser.
Java
16
star
49

asciidoctor-cli.js

The Command Line Interface (CLI) for Asciidoctor.js
JavaScript
15
star
50

asciidoctor-documentation-planning

⛔ ARCHIVED: Planning for the documentation that covers the AsciiDoc syntax, the Asciidoctor processor, and various projects in the Asciidoctor ecosystem.
15
star
51

asciidoctorj-groovy-dsl

A Groovy DSL that allows for easy definition of Asciidoctor extensions
Groovy
14
star
52

gulp-asciidoctor

gulp-asciidoctor
JavaScript
14
star
53

asciidoctor-docs-ui

The project that produces the UI (theme & user interactions) for docs.asciidoctor.org.
CSS
12
star
54

docs.asciidoctor.org

The Antora playbook project (i.e., site manifest) for the Asciidoctor documentation site.
JavaScript
11
star
55

asciidoctor-deck.js

⛔ ARCHIVED: deck.js converter templates for Asciidoctor, implemented in Haml
HTML
11
star
56

asciidoctor-doctest

🔨 Test suite for Asciidoctor backends
Ruby
10
star
57

asciidoctorj-reveal.js

AsciidoctorJ Reveal.js bundles the Asciidoctor Reveal.js RubyGem (asciidoctor-revealjs) so it can be loaded into the JVM using JRuby
Java
10
star
58

asciidoctor-ant

🐜 Ant task to render Asciidoc documentation
Ruby
9
star
59

asciidoctor-diagram-java

Java
9
star
60

asciidoctorj-diagram

AsciidoctorJ Diagram bundles the Asciidoctor Diagram RubyGem (asciidoctor-diagram) so it can be loaded into the JVM using JRuby.
Java
9
star
61

atom-asciidoc-image-helper

⚛ Tool to make insertion of images into AsciiDocs easier in the Atom editor.
CoffeeScript
9
star
62

atom-asciidoc-assistant

⚛ AsciiDoc Assistant package for the Atom editor.
Shell
9
star
63

asciidoctor-chrome-editor

⛔ ARCHIVED: AsciiDoc Editor inside Chrome!
JavaScript
8
star
64

guard-asciidoc

Guard::AsciiDoc monitors and automatically renders your AsciiDoc documents using Asciidoctor
Ruby
8
star
65

atom-autocomplete-asciidoc

⚛ AsciiDoc language autocompletions
CoffeeScript
7
star
66

asciidoctor-docbook.js

DocBook converter for Asciidoctor.js
JavaScript
7
star
67

asciidoctor-mallard

A Mallard 1.0 converter for Asciidoctor
Ruby
6
star
68

asciidoctor-lazybones

Lazybones templates for Asciidoctor projects
Groovy
5
star
69

asciidoctor-fb2

📕 Asciidoctor FB2 is an Asciidoctor extension for converting AsciiDoc to FB2
Ruby
5
star
70

html-pipeline-asciidoc_filter

⛔ ARCHIVED: An AsciiDoc processing filter for html-pipeline based on Asciidoctor.
Ruby
5
star
71

brand

Brand assets and visual identity for the Asciidoctor project
Shell
4
star
72

opal-node-runtime

⚡️ Opal Runtime specifically designed for Asciidoctor
JavaScript
4
star
73

asciidoctor-template.js

⛔️ DEPRECATED: Generic template backend for Asciidoctor.js
JavaScript
4
star
74

asciidoctor-deb-mirror

A mirror of the asciidoctor deb (Debian) package build in the pkg-ruby-extras package group. DO NOT PUSH CHANGES TO THIS MIRROR.
Ruby
3
star
75

docker-asciidoctorj

Ensure that AsciidoctorJ can be used by apps into a Java Application Server (WildFly AS for now)
Java
3
star
76

asciidoctor-community-docs

Process, policy, and other shared documentation for the Asciidoctor community of projects.
3
star
77

asciidoctorj-chart

AsciidoctorJ Chart bundles the Asciidoctor Chart RubyGem (asciidoctor-chart) so it can be loaded into the JVM using JRuby.
HTML
3
star
78

asciidoctor-grunt-plugin

A Grunt plugin that uses Asciidoctor via Asciidoctor.js to process AsciiDoc source files within the project.
HTML
2
star
79

asciidoctor-rpm-mirror

A mirror of the package spec for the rubygem-asciidoctor (alias: asciidoctor) rpm. DO NOT PUSH CHANGES TO THIS MIRROR.
Ruby
2
star
80

default-to-asciidoc-chrome-extension

You love AsciiDoc and you want it to be the default option, this extension is for you!
JavaScript
2
star
81

asciidoctorj-epub3

AsciidoctorJ EPUB3 bundles the Asciidoctor EPUB3 RubyGem (asciidoctor-epub3) so it can be loaded into the JVM using JRuby.
Java
1
star
82

asciidoctor-docbook45

!DEPRECATED! An Asciidoctor converter that converts AsciiDoc to DocBook 4.5. This converter is community maintained and will not be released. Use the built-in DocBook 5 converter instead.
Ruby
1
star