Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide scoped option to help with CSS styling #71

Open
webketje opened this issue Jul 4, 2023 · 0 comments
Open

Provide scoped option to help with CSS styling #71

webketje opened this issue Jul 4, 2023 · 0 comments
Labels
pr-welcome Pull Request to resolve this issue greatly welcomed

Comments

@webketje
Copy link
Member

webketje commented Jul 4, 2023

Please thumbs up 馃憤 this comment if you would like to use this feature, or thumbs down 馃憥 if you don't think it should be added . Your feedback is valued


scoped option wraps the contents in a <div class="rich-text">${contents}</div> when true, but defaults to false. scoped also accepts a string that will be used as the class for the wrapping div (rich-text by default).
This can already be accomplished by using a @metalsmith/layouts layout but it's a nice extra to have it as a built-in plugin option. CSS rules can be easily scoped to .rich-text * { ... }

Usage example:

metalsmith.use(markdown({ scoped: true }))
metalsmith.use(markdown({ scoped: 'rich-text' }))

// both render a file '*Hello _world_*' as '<div class="rich-text"><strong>Hello <em>world</em></strong></div>'

Readme must be updated, test added

@webketje webketje added the pr-welcome Pull Request to resolve this issue greatly welcomed label Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-welcome Pull Request to resolve this issue greatly welcomed
Projects
None yet
Development

No branches or pull requests

1 participant