asciidoctor / brackets-asciidoc-preview

Live Preview of AsciiDoc for Adobe Brackets
MIT License
51 stars 16 forks source link

Upgrade to Asciidoctor.js 1.5.6 #40

Closed ggrossetie closed 5 years ago

ggrossetie commented 6 years ago

Could you please try to upgrade to https://github.com/asciidoctor/asciidoctor.js/releases/tag/v1.5.6-preview.3 ? This is hopefully the latest release version before 1.5.6 final. Please let me know if you find any issue.

Thanks 😊

nerk commented 6 years ago

Yep, that's what I'm currently trying to do (based on your PR for 1.5.4). Basically, rendering is working, include:: also works.

However, the worker thread still produces

TypeError: Object # has no method 'get'
TypeError: Object # has no method 'get'

in my preview window console.

Debugging is a bit tricky because of the WebWorker thread and Chrome gives me a bad time setting breakpoints - for whatever reasons. Maybe a problem under Linux, might try this on a Windows machine.

I did not try extensions yet, must be converted using the new API.

Unfortunately, I am pretty busy with other things...

ggrossetie commented 6 years ago

I did not try extensions yet, must be converted using the new API.

Yes the way to go is to write extensions in JavaScript using the new API.

However, the worker thread still produces

Sorry this error doesn't sound familiar...

Unfortunately, I am pretty busy with other things...

No worries 😉

nerk commented 6 years ago

1.5.6-preview.3 seems to work for me, but I need some help creating an image block from my diagram extension. I am trying

return self.createBlock(parent, 'image', Opal.nil, {
        "target": requestUrl,
        "title": title
      });

which creates the following error message

include?: undefined method `include?' for nil

I think this has something to do with passing Opal.nil as the third parameter to createBlock(). Can you tell me how to create an image block with the extension API, without having an actual 'source' parameter?

Creating other types of blocks is working fine.

ggrossetie commented 6 years ago

To be honest, I've never tried to create an image block in an extension.

Could you try to use the method $create_image_block ? https://github.com/asciidoctor/asciidoctor/blob/master/lib/asciidoctor/extensions.rb#L150

I think this has something to do with passing Opal.nil as the third parameter to createBlock()

Maybe... but you should not use Opal.nil with the new API. We are trying to hide this implementation detail.

I think I will add a new function createImageBlock in the API and release a preview.4.

mojavelinux commented 6 years ago

It's because you have not specified the alt attribute. The alt attribute is required when creating an image node (though we could be nicer about how we enforce it ;))

nerk commented 6 years ago

@mojavelinux Bingo! Must have changed in newer versions of Asciidoctor.

ggrossetie commented 6 years ago

Do you want to add this check in the Ruby API ? In the meantime I can add this check in the JavaScript API on the future createImageBlock() function.

Le 1 août 2017 2:28 PM, "Thomas Kern" notifications@github.com a écrit :

@mojavelinux https://github.com/mojavelinux Bingo! Must have changed in newer versions of Asciidoctor.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/asciidoctor/brackets-asciidoc-preview/issues/40#issuecomment-319355787, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUV3G1lcHkJ6dv6fUSfDJsLH_nyotZTks5sTxnugaJpZM4Onskd .

mojavelinux commented 6 years ago

@nerk yes, this was a change in Asciidoctor 1.5.6. We moved when the default alt text was defined so we could apply the substitutions correctly.

I do think this should be checked in the create_image_block method. In fact, it should check for target too, which is also required. Let's pursue that change in core.

charlottedeclercq commented 6 years ago

Hi,

I read the documentation http://asciidoctor.org/docs/user-manual/#customizing-the-cross-reference-text but still can not manage to have the link displayed as Chapter 1 or Section 1.1 instead of France or Paris (in my example). This is possible since issue 858 has been fixed : https://github.com/asciidoctor/asciidoctor/issues/858.

:xrefstyle: full
= Hello
== France
=== Paris
xref:France[]
<<France>>
<<Paris>>

Unfortunately this is rendered as

image

I know I am missing something but what ?

Thank you for your help.

Charlotte

nerk commented 6 years ago

I assume you are seeing this in the 1.5.6 branch of the plugin?

charlottedeclercq commented 6 years ago

I downloaded the branch version but I have a white screen when launching the preview.

nerk commented 6 years ago

I did not merge the branch yet, because I wanted to wait for Asciidoctor.js 1.5.6 final. Could you please hit F12 in Brackets and check for errors in the console?

Make sure you do not have any custom extensions in AppData/Roaming/Brackets/extensions/data.nerk.asciidoc-preview or .config/Brackets/extensions/data.nerk.asciidoc-preview.

Existing extensions are not compatible with Asciidoctor.js 1.5.6 - another reason why I did not merge yet.

nerk commented 6 years ago

I just tried your example with the 1.5.6 plugin and it's working for me.

charlottedeclercq commented 6 years ago

image

nerk commented 6 years ago

Seems something is wrong with your installation. Did you actually build a zip file (npm install, grunt dist) and installed the zipfile using the Brackets extension manager?

Try the following:

charlottedeclercq commented 6 years ago

This is working now ! Many thanks.

image

charlottedeclercq commented 6 years ago

Thanks, display is working but include::filename.adoc[] does not work anymore.

nerk commented 6 years ago

@charlottedeclercq Include:: works for me. Could you post some AsciiDoc to reproduce the problem?

nerk commented 6 years ago

@charlottedeclercq Which version of Brackets are you using? Mine is 1.10

charlottedeclercq commented 6 years ago

I installed version 1.11 right now, I was using 1.8. I still can not see the content called by include :

image

charlottedeclercq commented 6 years ago

Ok I found the problem, installing the new version changed teh safe mode to Secure. I put it back to Server and it is working fine again.

image

mojavelinux commented 6 years ago

:+1:

ggrossetie commented 5 years ago

Asciidoctor.js 1.5.9 is out! https://github.com/asciidoctor/asciidoctor.js/releases/tag/v1.5.9 @nerk If you are still working on this project I can help you with the update 😉

nerk commented 5 years ago

@Mogztter Great news, thanks. I'm definitely planning to do an update, hopefully during the next days. I've been too busy with a lot of other stuff, unfortunately. I'll let you know in case I need help.

ggrossetie commented 5 years ago

Alright :+1:

nerk commented 5 years ago

Version 2.0.0 uses Asciidoctor.js 1.5.9.

ggrossetie commented 5 years ago

Awesome, thanks for the upgrade @nerk!