-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
feature/code builder #77
feature/code builder #77
Conversation
feature: added better type hinting for Meta properties and Frontmatter properties fix: fix type errors found in "head.ts"
- refactored to better isolate builders and include clearer pipeline operation
…erComponent property is used or not
…to ensure full engagement with useHead functionality
…ality, and the frontmatter pre-processor refactor: improvements to happy-wrapper library and use of these improvements to improve the code builder's transform pipeline
chore: add test coverage testing refactor: removed shiki code
chore: attempts to get Cypress component tests working
- fix: fix type errors found in "head.ts" - test: cypress testing works in very limited way but not when running in "tabular layout" - test: vitest has been isolated from cypress symbol collisions - fix: removed cypress cruft from their install process - feature: added better type hinting for Meta properties and Frontmatter properties Co-authored-by: Anthony Fu <[email protected]> chore: update deps docs: update README.md (antfu#68) docs: import quote (antfu#70) fix: loss information from <script> in md chore: fix typo (antfu#73)
Note: I have no idea why no types for happy wrapper are visible to CI:CD but since I was going to extract that as a separate repo anyway, i'll just do that now. |
pnpm-global/5/pnpm-lock.yaml
Outdated
@@ -0,0 +1,7 @@ | |||
lockfileVersion: 5.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmmm. Not sure. Must have been an old pnpm link
i'll get rid of it.
I am good with it as long as you believe it's the right thing to do. Overall I am a bit concerned about the pipelines added to the repo, isn't that a bit like we are building another plugin system on top of markdown-it? Do you think it would be better to extract the builder into a standalone library so many other integrations could benefit from it as well? (just an idea, we could merge it as-is and do this for later, as you prefer) |
There's no question there is some overlap in utility with Now the new pipeline simply incorporates the before/after props of the Bear in mind, the "scope" of this new pipeline transform is intended to allow interested actors to intercept at the appropriate part of the transformation pipeline which includes the transformation of MD to HTML but also includes up and downstream transforms as well. A Markdown-IT plugin is purely focused on the MD-to-HTML transformation. This is an important part of the pipeline but not the only part. I have also found that while markdown-it has good docs and decent types, for many developers there's a bit of friction in getting their heads around how to tap into this ecosystem (other than just pulling plugins off the shelf). I do think that the remaining "builders" very likely should be created as external repos. An external builder has precisely the same access as an internal one. The internal ones just provide reference and convenience. I had planned on creating two more smallish builders in the short term:
I had kind of gotten in the habit of thinking of these as "built-in" because I feel they have high reuse potential but if you prefer I'm happy to develop these externally. Maybe then we can reference them in the docs as examples of how people can add their own. |
I also wonder how much of the pipelines is "just in my head" versus described in a manner others can follow in the docs. I think it might be worth getting the docs a bit more touched up to accurately reflect my thinking and I'm hoping that this might actually make you feel better about this pipeline as I think this plugin is awesome and could be a fundamental building block but I do think it needs something like a formal mutation pipeline to allow it to grow into what it needs to be for various people. |
Thanks for the explanation! I like the idea of your transforming pipeline and I do think they are more flexible. I am totally fine to have them inside the repo, or move to a package. The benefit I see of having them as a package is that:
That said, just an idea and it's totally up to you. No pressures. Feel free to merge and release it when you think it's ready. Thanks. |
I'll merge this in; have raised a tiny PR which just updates the description of the Builder API a bit. Would love your feedback if you have time. |
@yankeeinlondon Do you use Discord? You can add me with antfu#3212 |
Yes will do that after my morning coffee :)
Been wanting to find a good back channel to chat over.
Ken
…On Fri, Jun 17, 2022 at 10:46 PM Anthony Fu ***@***.***> wrote:
@yankeeinlondon <https://github.com/yankeeinlondon> Do you use Discord?
You can add me with antfu#3212
—
Reply to this email directly, view it on GitHub
<#77 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHPOFN5KCOC2TN4XCZ3LHTVPVPFDANCNFSM5W2A4CLA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@antfu another apology about the size of this PR, let me break it down for you:
Core
0.13.1
createBuilder()
... which is recommended ... then it's fully backwards compatiblecreateBuilder()
and so no problems thereHappy Wrapper
while working with happy-dom I found myself wanting a more functional interface to it's API
currently it resides here as a separate "package" but the intent is to extract it as it's own package once the rate of change slows down (which actually it largely has now)
I have to say I was surprised about how shit I was at using the DOM API directly but having gone through this exercise I feel much better and the functional surface of
happy-wrapper
can be quite nice when working inside a transformation pipeline:Meta Builder
useHead
andmeta
to make them work and tests are includedCode Builder
Testing
code()
builderMarkdown Linting?
To do some fixture testing I added a
.markdownlint.json
file and excluded some rules regarding the mixing oftitle
andH1
elements and that worked until I noticed a few cases where I see that ESLint appears to be complaining about MD files. Here's an example:I didn't know that ESLint could cover MD scopes but maybe it can. Anyway, would like like a little advice how I should handle this.
Next Steps
I will create another PR that cleans up the remaining formatting issues with the code builder and hope to work in the sourcemap support into that but I think this one can be released "as is" as the core functionality is only improved.