-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Handle unsupported options for include directive #1872
Conversation
🦋 Changeset detectedLatest commit: 1a235b8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@agoose77 That will probably be helpful. I've done a little exploring in the code and found where the |
The usual pattern in rg -t ts -i "include\S*(directive|transform)" The non- mystmd/packages/myst-transforms/src/include.ts Lines 124 to 126 in 0ca2c67
|
Taking a look at this, I think you're right that the only required change is to pass-through the filter options from the directive, i.e. you don't need to touch the transform. The following lines define the filter: mystmd/packages/myst-directives/src/include.ts Lines 97 to 125 in 2299471
|
🎉 That was going to be the first thing I tried hoping it worked 😆. I can see that the code essentially says "if not literal ignore all options, otherwise apply options" so I was hoping I could simply change that 👍. |
That appears to be the case! Are you happy adding those changes to this PR? |
Yep, I'll get on to that 🚀. |
I'm getting the same test errors on main as on this branch, so I |
Co-authored-by: Angus Hollands <goosey15@gmail.com>
Perhaps
Would this work? caption: literal ? data.options?.caption as any[] : [], |
@JimMadge I've fixed the tests — this PR broke them because the test fails if the new AST has attributes that the expected AST does not. Regarding |
Ah, I think I must have forgotten to build after checking out main 🤦 |
I think these changes would mean a patch release from my reading of https://github.com/jupyter-book/mystmd/blob/main/CONTRIBUTING.md |
Closes #813
include
to respect start/end options #813 and Update governance and community documents to reflect current status the-turing-way/the-turing-way#4049The filters get applied for non-literal includes. The code change is just removing a conditional block which made an early return when
literal === false
. This does mean includes are slightly more expensive now, and I think some of the processing of filter/options doesn't make sense whenliteral === false
. It does keep the code quite clean and simple though.I've tested this locally, but haven't added any tests.