# 게시물 본문 링크에 스타일링용 클래스 추가하기

**URL:** https://meta.discourse.org/t/adding-classes-to-links-in-post-body-for-styling/131027
**Category:** Development
**Created:** [10월 15, 2019, 10:13오전 UTC](https://meta.discourse.org/t/adding-classes-to-links-in-post-body-for-styling/131027 "2019-10-15T10:13:17Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [10월 15, 2019, 1:17오후 UTC](https://meta.discourse.org/t/adding-classes-to-links-in-post-body-for-styling/131027/3 "2019-10-15T13:17:17Z")

</div>

이렇게 하려면 다음과 같은 것을 사용하세요.

> [@Generic bbcode wrapper for theme components](https://meta.discourse.org/t/generic-bbcode-wrapper-for-theme-components/123516):
>
> 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. // 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 w…

예를 들어

`[wrap=link-button][Link Text](http://meta.discourse.org)[/wrap]`

은 다음과 같이 렌더링됩니다.

[Link Text](http://meta.discourse.org)

그리고 마크업은 다음과 같습니다.

```html
<div class="d-wrap" data-wrap="link-button">
  <p>
    <a href="http://meta.discourse.org">Link Text</a>
  </p>
</div>

```

그런 다음 CSS에서 다음과 같이 스타일을 적용할 수 있습니다.

```scss
[data-wrap="link-button"] {
  a {
    // 링크 스타일
  }
}

```

`[wrap=link-button]`을 원하는 값으로 변경할 수 있습니다. 예를 들어

`[wrap=custom-button]` 또는  
`[wrap=home-link]` 또는  
`[wrap=foobar]`

로 변경한 후, 위 예시처럼 해당 링크를 대상으로 사용할 수 있습니다.

---

_[View the full topic](https://meta.discourse.org/t/adding-classes-to-links-in-post-body-for-styling/131027)._
