# Generic bbcode wrapper for theme components

**URL:** <https://meta.discourse.org/t/generic-bbcode-wrapper-for-theme-components/123516>\
**Category:** Announcements\
**Tags:** new-feature\
**Created:** [July 20, 2019, 12:48pm UTC](https://meta.discourse.org/t/generic-bbcode-wrapper-for-theme-components/123516 "2019-07-20T12:48:59Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)\
**Post date:** [July 20, 2019, 12:49pm UTC](https://meta.discourse.org/t/generic-bbcode-wrapper-for-theme-components/123516/1 "2019-07-20T12:49:00Z")

</div>

I added this feature a while back and realised I didn’t post about it. You can now use a special syntax in markdown to have it cooked and usable in theme components without having to write a plugin.

```plaintext
// wrapped in div.d-wrap
[wrap=baz foo=bar]Content[/wrap]

// wrapped in div.d-wrap
[wrap=baz foo=bar]
Content
[/wrap]

// wrapped in div.d-wrap
[wrap=baz foo=bar]
[/wrap]

// this one will be rendered as a span.d-wrap instead of a div.d-wrap
a [wrap=baz]Content[/wrap] b

```

The name of the component will be added as a data-attribute: `data-wrap="baz"` and every properties will also be data-attributes: `data-foo="bar"` on the element.

If you want to read about a real world use case, see

> [@Placeholder Forms](https://meta.discourse.org/t/discourse-placeholder-theme-component/113533):
>
> discourse2Summary Placeholder Forms will let you build dynamic documentation, by creating a form that replaces any occurrence of a =PATTERN= in your post with the value from a text or selectable input field.eyeglassesPreview [Preview on Discourse Theme Creator](https://discourse.theme-creator.io/theme/Discourse/placeholder-forms)hammer_and_wrenchRepository Link [https://github.com/discourse/discourse-placeholder-theme-component](https://github.com/discourse/discourse-placeholder-theme-component)open_bookNew to Discourse Themes? [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) Install this theme component …

---

_[View the full topic](https://meta.discourse.org/t/generic-bbcode-wrapper-for-theme-components/123516)._
