asciidoctor/asciidoctor.js

Setting context of Abstract node no longer working?

RayOffiah opened this issue · 3 comments

Hi there.

Ive submitted a PR which adds a setContext to the AbstractNode.

#1718

This was originally done because I thought that the ability to set the value had been removed.

This line used to work:

node.context = 'colist'

But running it against Asciidoctor.js 3.0.2, and my IDE flags up that it cannot access change the value directly, and the running code comes back with:

error TS2339: Property 'context' does not exist on type 'AbstractBlock'.

which leads me to believe that the context is no longer exposed. (I have a feeling that being able to set it directly in version 2.2.6 may have been a happy accident that that I was taking advantage of.

So why am I fiddling with it. Well I wrote a Asciidoctor extension a few years ago, that uses that to change an ordered list into a callout list.

https://www.npmjs.com/package/asciidoctor-external-callout

I'd like to update it to make sure it can still work with current and future versions of the API.

I don't think it was removed so much as it was not added to the TypeScript definition. The error you are getting is not a JavaScript error, but rather a TypeScript error. If TypeScript is not involved, that assignment would work.

Ah, okay. That makes sense. It's just become invisible … sort of.