Closed JBR69 closed 7 years ago
Right now, you can not easily do that, I think.
If your extension is written in Ruby, one way might be to create your own version of asciidoctorjs which includes your extension. Have a look at asciidoctor.js.
Then replace asciidoctor-all-min.js from the installed Brackets preview extension with you own version.
Like with the Chrome extension, it might be nice to be able to specify addition JavaScript files to load in the configuration. That way, a user can transpile the Ruby-based extension to JavaScript using the Asciidoctor.js build and add it to Brackets. The Brackets plugin need not worry about how to prepare the extension, just how to load it into the runtime.
Btw, there are some pre-compiled extensions you can test at https://github.com/asciidoctor/asciidoctor.js/tree/v1.5.5-1/dist (such as the emoji inline macro).
@mojavelinux Thanks for the hint, Dan. Certainly a pretty useful feature and not difficult to add. Maybe I'll just provide an extension directory into which a user can simply drop his own extensions.
That's a great idea!
I'm glad to see you wear an interest in my request.
I had a little trouble understanding how to regenerate asciidoctor-all-min.js
with my extension (translated from Ruby to JS) and here's how I did on Windows (this may interest the other person begins like me) :
1- Install Node.js
(https://nodejs.org/en/download/)
2- Get asciidoctor.js project
(https://github.com/asciidoctor/asciidoctor.js)
3- In this project, copy my extension (Ruby) in the extensions-lab
directory
4- Modify npm/builder.js
to include my extension
Ligne 300 : {source: 'build/asciidoctor-my-extension.js', destination: 'build/asciidoctor-my-extension.min.js' }
Ligne 467 : opalCompileExtensions(['chrome-inline-macro', 'man-inline-macro', 'emoji-inline-macro', 'chart-block-macro', 'my-extension']);
5- Build project
set MINIFY=1
node npm/build.js
6- In the build directory, copy the contents of asciidoctor-my-extension.min.js
at the end of asciidoctor-all.min.js
7- Copy asciidoctor-all.min.js
in C:\Users\XXX\AppData\Roaming\Brackets\extensions\user\nerk.asciidoc-preview\lib
8- Restart Brackets ==> my extension (adding new block admonition) is visible in the AD preview.
Now I look forward to developments which would put only the javascript file extension in a specific directory.
Jérôme
Cool, glad it worked for you! Extensions directory would be much more painless.
Custom extensions, CSS, and JavaScript files can now be installed (see updated README).
Hi,
How to use personnal asciidoctor extensions in brackets asciidoc preview ?
ty Jérôme