You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on a custom markdown extension for my app but I need to access some global state that is in a service. I'd like to be able to use a Provider with a factory so that I can inject the service and use that when creating the extension. I'd imagine that the markedExtensions array could be updated to be (MarkedExtension | Provider)[] to support this. Currently I'm having to work around this by providing a MARKED_OPTIONS factory that uses the extensions property of MarkedOptions to do this, but this is very hacky as I have to split the extension into renderer, tokenizer, etc. and it makes it difficult to share things between them.
I'd like to be able to do something like the following in my app config:
I am fine with either having the factory return the entire markedExtensions array, or being able to include multiple providers in that array, either works for me. Also it would be nice if that factory could return a Promise that is awaited too, so that I don't have to hack some synchronous code together like I'm doing now.
Basically, I have data that is loaded from a service (which loads data from an API) that I need to use in my custom Markdown extension to determine if matches should be turned into links. Marked docs say that they can support async, although the Typescript types don't seem to support that. But if I can asynchronously load the data from the API and then return the extension populated with the data, that would be fine too.
I'm working on a custom markdown extension for my app but I need to access some global state that is in a service. I'd like to be able to use a Provider with a factory so that I can inject the service and use that when creating the extension. I'd imagine that the
markedExtensions
array could be updated to be(MarkedExtension | Provider)[]
to support this. Currently I'm having to work around this by providing aMARKED_OPTIONS
factory that uses theextensions
property of MarkedOptions to do this, but this is very hacky as I have to split the extension into renderer, tokenizer, etc. and it makes it difficult to share things between them.I'd like to be able to do something like the following in my app config:
The text was updated successfully, but these errors were encountered: