Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting context of Abstract node no longer working? #1719

Closed
RayOffiah opened this issue Dec 28, 2023 · 3 comments
Closed

Setting context of Abstract node no longer working? #1719

RayOffiah opened this issue Dec 28, 2023 · 3 comments

Comments

@RayOffiah
Copy link
Contributor

RayOffiah commented Dec 28, 2023

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.

@mojavelinux
Copy link
Member

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.

@RayOffiah
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants