Skip to content

Provide scoped option to help with CSS styling #71

@webketje

Description

@webketje

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    pr-welcomePull Request to resolve this issue greatly welcomed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions