-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Output deprecation warning when use dollar prefix in global directive #183
Conversation
const globalKey = key.startsWith('$') ? key.slice(1) : key | ||
const globalKey = key.startsWith('$') | ||
? (() => { | ||
if (marpit.customDirectives.global[key]) return key |
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 use an original directive key without warning if the dollar-prefixed custom global directive was defined.
|
||
for (const prop of Object.keys(newProps)) { | ||
if (builtinDirectives[prop]) { | ||
ret = { ...ret, ...builtinDirectives[prop](newProps[prop], marpit) } |
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.
When aliasing from custom directive to built-in directive, we will re-apply function of built-in directives to allow only valid value.
- Remove an example of global directive with dollar prefix - Add advanced section to explain about custom directives
A usage of custom directives was well-organized by the change of this PR. Thus, I've updated document of directives to explain about custom directives. |
Marpit will output deprecation warning when using dollar-prefixed global directive. See also #182.
It would be hard to notice this warning if user is using GUI tool like Marp Web and Marp for VS Code. Marp CLI user can see this warning in console.
Prefix removal will do step by step to avoid confusion. We are planning to provide (optional) prefixed custom directives in Marp Core. We have to remove meta filter, to override built-in meta by using custom defined directive for Marp Core.
ToDo