-
Notifications
You must be signed in to change notification settings - Fork 132
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 plugins functionality #474
Conversation
Bare in mind that authors will not have direct access to the source, as they install MarkBind with |
Sure - I don't think that's a problem. |
Updated |
ced05ad
to
7f81648
Compare
Resolved merge conflict and updated, sorry I'm not sure how so many of them got missed out,... |
Does this mean that we expect user to copy-paste the file if #467 is converted into a plugin?
When looking for plugins, we should use the order 3 → 1 → 2 to facilitate overrides. |
I was thinking we can have a few plugins that are 'installed' by default that the user can enable or disable, so they won't have to download separate files.
Would this be installed in the markbind source folder? Like @yamgent mentioned we probably don't want them touching the source. Either that or they can install them in to the project folder, but that's still a little troublesome, and it also means they can't be shared among projects. What do you think of a
We can have a |
Do you mean built-in plugins? This MR does not support that yet right?
No, it's installed into the project directory, like ESLint.
Can you elaborate why they can't be shared?
No, we can use NPM.
Yes, that was the original intention — built-in plugins. |
By project directory are you referring to the |
No, I'm referring to the project directory — the folder for a specific markbind website (like This MR uses the project directory to support local plugins, but the user has to copy-paste the file. NPM modules can be installed by multiple projects, which is what I mean by shared. |
Ah I see, but the user still has to run |
Yes, that's how ESLint plugins are installed. |
In the first stage of adding this feature, we could limit it to simply a way for the dev team to add functionality easily i.e., the plugin mechanism is not necessarily visible to end users. As our philosophy is to optimize for a specific target user group, we want most functionality to be in the box (they can be plugins enabled by default) and ready-to-use by that target user group, which means only in a rare case a user will need to tinker with plugins. |
@damithc Ah - In that case should the options in the |
No, users should be able to remove plugins. |
👍 |
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.
We still need to support built-in plugins.
699dbfc
to
8f61ba1
Compare
Updated, rebased on master to solve merge conflict |
Updated, renamed siteContext to pluginsContext |
We still need to support built-in plugins. |
@acjh Hi, just to confirm, what other changes do you need from this PR? For the built-in (installed by default) plugins I was thinking of adding them in the PR where we actually start converting the features into plugins, if I wrote the feature at this point the functionality would likely be placeholder and would probably have to be rewritten in future. |
Hmm, but this PR only supports the usage with the lowest priority.
|
d3fafc5
to
95f110f
Compare
Updated, I'm getting a problem with netlify, can someone help me with this error? Edit: resolved |
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.
Resolve conflicts.
95f110f
to
bb02b94
Compare
Rebased! |
@jamos-tay can users do anything with the built-in plugins? e.g., disable them |
Oh they are disabled by default, to enable them the user has to put the plugin name in |
So the tags feature no longer works by default? |
Oh yeah, this PR changes the way the site json is specified: Old:
New:
The reason is because we didn't want to clutter up the top level of the configuration with less important properties. I think the section in the docs wasn't cleaned up, let me do it now. |
Specifically, if I want to use tags in a page via frontmatter, (i.e., not via site.json), how do I do that? |
The
Hmm, I think I should make it such that it defaults to empty because not specifying an empty array causes errors |
A few other thoughts:
|
You mean like
? |
The benefits of specifying it separately:
|
Should it be kept the way it is then? There are a number of plugins that don't require parameters (anchors, syntax improvements) so empty defaults may look ugly. |
Sure. BTW, I'm still inclined to enable built-ins by default and allow disabling if they want to e.g., for performance reasons. As our promise is to optimize for a certain target user group, it is our job to provide all the needed functionality out of the box. It can also be one way we differ from others. i.e., 'All features built-in; no need to fiddle with plugins' |
It was also mentioned by @jamos-tay in #495 (comment). We can allow disabling by accepting |
What is the purpose of this pull request? (put "X" next to an item, remove the rest)
• [X] New feature
Fixes #470
What is the rationale for this request?
Allow MarkBind to use plugins, making it more customisable.
What changes did you make? (Give an overview)
Add plugins functionality:
Plugins are placed in
_markbind/plugins
folder.User specifies plugins to use in
site.json
.Plugins allow user to specify a
preRender
andpostRender
function.Is there anything you'd like reviewers to focus on?
How do we want to handle plugin dependencies (
require
)? Right now I'm just usingmodule.parent.require
to get libraries from the markbind source, but if the user wants to use his own libraries he'd have to install them somewhere in his project. Perhaps within the plugin folder?