-
-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add support for frontmatter #390
base: main
Are you sure you want to change the base?
Conversation
reword 53d0916 test: Green test without frontmatter
@@ -47,6 +47,7 @@ | |||
"tsconfig.json" | |||
], | |||
"dependencies": { | |||
"gray-matter": "^4.0.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.
Can we potentially use an optional dependency somehow here? Nearly every user that use my plugin don't use frontmatter. You are the first case in 2-3 years.
Adding a direct dependency would result in not used content for thousands of users.
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.
I might experiment, but gray-matter is a relatively small lib, so I don't know if it's worth the trouble...
What do you think?
j.langeveld@nicagini ~/git/github/jlangeveld/plugin-pug
> du -sh node_modules/gray-matter/
96K node_modules/gray-matter/
[task/Make_frontmatter-parsing_optional]
j.langeveld@nicagini ~/git/github/jlangeveld/plugin-pug
> du -sh node_modules/
190M node_modules/
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.
It brings sub-dependencies with it... https://github.com/jonschlinkert/gray-matter/blob/a5726b04f3167fadc764241deb545518c454eb82/package.json#L36-L41
And these have sub-sub-deps and so on.
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.
Oooooohhhhhhhh.... yes.
I should have realised.
j.langeveld@nicagini ~/git/github/gray-matter
> du -sh node_modules/
32M node_modules/
I'll see what I can do.
Maybe copy this https://github.com/prettier/prettier/blob/f2244bdc8621c0a001e3717f595bc8fd8653cce7/src/utils/front-matter/parse.js#L50? Or should Prettier expose it? |
Sorry for being off the radar, got a bit swamped... However, I got hung up trying to convince typescript to accept this javascript code without erorring out on missing type declarations. |
Closes #389
First round - yaml frontmatter is being parsed en re-inserted.
Graymatter supports json out of the box, so I want to work that in too...