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

feat(myst plugin): Implement working MySt Plugin #2219

Merged
merged 17 commits into from
Jul 21, 2024

Conversation

vijay-prema
Copy link
Collaborator

No description provided.

@vijay-prema vijay-prema self-assigned this May 13, 2024
@vijay-prema vijay-prema force-pushed the feat/myst-plugin-implement branch 2 times, most recently from 7da3167 to 2a63683 Compare May 29, 2024 04:18
@vijay-prema vijay-prema force-pushed the feat/myst-plugin-implement branch 2 times, most recently from d0e4a75 to 8d38cbb Compare June 7, 2024 08:13
@nokome
Copy link
Member

nokome commented Jun 13, 2024

Thanks for this @vijay-prema.

A little bug I noticed: when encoding, there is no blank line after admonition, table, figure etc. These need to be encoded with a \n\n at the end like paragraph does.

There are a few Stencila node types for which encoding is not implemented but which can be. We should ensure these types are also handled in decoding also (i.e. ensure we have full roundtrip encoding/decoding).

@rowanc1
Copy link

rowanc1 commented Jun 14, 2024

Expressing so much excitement for this work. Thank you both and excited to chat through how I can help next week!

@nokome
Copy link
Member

nokome commented Jun 20, 2024

Some notes from me before we discuss later today...

Plugin integration

  • I've been working on adding codecs as something that plugins can provide (currently it is limited to kernels and assistants)
  • This was progressing fine until I hit a circular dependency in our internal Rust crates - that requires some refactoring by me to avoid that
  • Due to a recent change in the serialization of the Cord type (a string with character level attribution) there will need to be a few changes to the decoding functions in the PR (but they are minor)
  • I need to do some more thinking around how we pass the internal node_id to the plugin so it can be used in the encoding mapping. Currently we are (ab)using the id property - which is probably OK, but which might also conflict if the user is using id for something.

MyST directives for AI instructions and suggestions

Now, for the interesting stuff 😃 . We want to add MyST directives (block level) and roles (inline level) for Stencila's InstructionBlock and InstructionInline nodes. This would allow users to edit MyST documents in Stencila and make use of AI assistants. These custom directives would be parsed and translated into the instruction node types by this plugin.

I'm currently working on a refactor of instructions (allowing for more control, multiple suggestions and feedback on each), and our focus is on getting the syntax for blocks right first, so here are some very quick sketches of what those might look like:

:::{new}
:assignee: code-table
:reps: 3
:temp: 80
total counts by year and region
:::

:::{suggest}
:feedback: exclude last four years
<the suggested table>
:::

Stencila plugin for MyST

To allow users to use Stencila's assistants in other editors we could create a plugin to MyST https://mystmd.org/guide/plugins (this would effectively be the inverse of this plugin). This would be a different PR that would probably use our Node.js bindings to make use of core functionality for calling assistants etc.

@nokome nokome merged commit 6f6bb28 into main Jul 21, 2024
3 checks passed
@nokome nokome deleted the feat/myst-plugin-implement branch July 21, 2024 06:02
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

Successfully merging this pull request may close these issues.

None yet

3 participants