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

Proposal: a data feature for sharing information across extensions #3039

Open
bent10 opened this issue Oct 16, 2023 · 1 comment
Open

Proposal: a data feature for sharing information across extensions #3039

bent10 opened this issue Oct 16, 2023 · 1 comment
Labels

Comments

@bent10
Copy link
Contributor

bent10 commented Oct 16, 2023

What pain point are you perceiving?

The objective of this proposal is to introduce a data feature that allows us to share information across extensions using a key-value pairs object.

Describe the solution you'd like

  • Introduce a data object that can be accessed within any extension

  • The data is essentially a key-value pairs object where extensions can set and retrieve data

  • Extensions can use a simple API to set and retrieve data in the data object through the walkTokens, pre/post hooks, and custom extensions fields (specifically, tokenizer and renderer)

    An extension can set data like this:

    this.setData('foo', 'bar')

    Then we can retrieve the data set:

    this.getData()  // returns {foo: 'bar'}
    this.getData('foo')  // returns 'bar'
  • The data will be scoped to the current Marked instance to prevent conflicts between extensions in different instances

Benefits:

  • Enhanced Collaboration
  • Access and utilize data from other extensions (Extensibility)
  • Ability to pass context or configuration data among different extensions
@UziTech
Copy link
Member

UziTech commented Oct 16, 2023

All of those benefits seem possible without marked being the holder of this data object. For example the marked-gfm-heading-id extension provides a list of the headings for a table of contents extension to use.

What is the benefit of marked holding this information if marked isn't using any of it?

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

No branches or pull requests

2 participants