- Notifications
You must be signed in to change notification settings - Fork147
fix: remove preprocessor-specific attributes#653
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -123,8 +123,9 @@ export default { | ||
| /** Add a custom language preprocessor */ | ||
| potatoLanguage({ content, filename, attributes }) { | ||
| const { code, map } = require('potato-language').render(content); | ||
| const { src, ...cleanedAttributes } = attributes; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. this example does not make sense as i assume potato-language uses the lang attribute value. If you want to show it here, the preprocessor would have to use a custom | ||
| return { code, map, attributes: cleanedAttributes }; | ||
| }, | ||
| }), | ||
| }), | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -67,3 +67,9 @@ export const getTagInfo = async ({ | ||
| markup, | ||
| }; | ||
| }; | ||
| export const removeSrcAttribute = (attributes: Record<string, any>) => { | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. should this be a generic util? exportconstfilterAttributes(attributes:Record<string,any>,filterFn:(a:string)=>boolean){returnObject.fromEntries(Object.entries(attributes).filter(([a])=>filterFn(a)))} usage: constcleanAttributes=filterAttributes(attributes,a=>a!=='src');// orconstattributesToRemove=['foo','bar'];constcleanMultipleAttributes=filterAttributes(attributes,a=>!attributesToRemove.includes(a)) that can be reused for global and potentially others? | ||
| const { src, ...rest } = attributes; | ||
| return rest; | ||
| }; | ||