본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

Headers and text

원문 보기 위키 갱신

Headers and text (헤더와 텍스트)

최적의 가독성을 위해 아름답게 스타일링된 제목, 문단, 텍스트 서식, 링크를 다루는 가이드예요. 마크다운과 app.config.ts 테마 설정을 함께 설명해요.

출처: Nuxt UI

본문

가독성을 위해 아름답게 스타일링된 제목(headings), 문단, 텍스트 서식, 링크를 다룹니다.

제목 (Headings)

제목으로 콘텐츠를 구성하면 읽기 훨씬 쉬워져요.

제목에 id가 있으면 앵커 링크로 감싸져서, H2와 H3(큰 화면에서)에 호버하면 해시 아이콘이 표시되어 독자가 해당 섹션으로 바로 연결할 수 있어요.

앵커 링크는 @nuxt/content를 사용할 때 H2부터 H4까지 기본으로 활성화되고, 그 외(Comark 포함)에서는 비활성화돼요. 앱의 특정 섹션에 대해서는 anchor prop을 가진 Theme 컴포넌트로 켜고 끌 수 있어요:

<template>
  <UTheme :props="{ prose: { h2: { anchor: true }, h3: { anchor: true }, h4: { anchor: true } } }">
    <!-- your rendered markdown -->
  </UTheme>
</template>

Nuxt:

[!NOTE]

@nuxt/content를 사용하면 H2, H3, H4에 앵커 링크가 기본으로 켜져요. nuxt.config.ts에서 그 생성(예: AI 채팅 인터페이스용으로 끄기)과 toc 생성을 제어할 수 있어요:

export default defineNuxtConfig({
  content: {
    renderer: {
      anchorLinks: false
    },
    build: {
      markdown: {
        toc: {
          depth: 3
        }
      }
    }
  }
})

제목 1 (Heading 1)

# Nuxt UI
export default defineAppConfig({
  ui: {
    prose: {
      h1: {
        slots: {
          base: 'text-4xl text-highlighted font-bold mb-8 scroll-mt-[calc(45px+var(--ui-header-height))] lg:scroll-mt-(--ui-header-height)',
          link: 'inline-flex items-center gap-2'
        }
      }
    }
  }
})

제목 2 (Heading 2)

## What's new in v4?
export default defineAppConfig({
  ui: {
    prose: {
      h2: {
        slots: {
          base: [
            'relative text-2xl text-highlighted font-bold mt-12 mb-6 scroll-mt-[calc(48px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(48px+var(--ui-header-height))] [&>a]:rounded-sm [&>a]:outline-primary/25 [&>a]:focus-visible:outline-3 [&>a>code]:border-dashed hover:[&>a>code]:border-primary hover:[&>a>code]:text-primary [&>a>code]:text-xl/7 [&>a>code]:font-bold',
            '[&>a>code]:transition-colors'
          ],
          leading: [
            'absolute -ms-8 top-1 opacity-0 group-hover:opacity-100 group-focus:opacity-100 p-1 bg-elevated group-hover:text-primary group-focus:text-primary rounded-md hidden lg:flex text-muted',
            'transition'
          ],
          leadingIcon: 'size-4 shrink-0',
          link: 'group lg:after:absolute lg:after:inset-y-0 lg:after:-inset-s-2 lg:after:w-2'
        }
      }
    }
  }
})

제목 3 (Heading 3)

### Enhanced components
export default defineAppConfig({
  ui: {
    prose: {
      h3: {
        slots: {
          base: [
            'relative text-xl text-highlighted font-bold mt-8 mb-3 scroll-mt-[calc(32px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(32px+var(--ui-header-height))] [&>a]:rounded-sm [&>a]:outline-primary/25 [&>a]:focus-visible:outline-3 [&>a>code]:border-dashed hover:[&>a>code]:border-primary hover:[&>a>code]:text-primary [&>a>code]:text-lg/6 [&>a>code]:font-bold',
            '[&>a>code]:transition-colors'
          ],
          leading: [
            'absolute -ms-8 top-0.5 opacity-0 group-hover:opacity-100 group-focus:opacity-100 p-1 bg-elevated group-hover:text-primary group-focus:text-primary rounded-md hidden lg:flex text-muted',
            'transition'
          ],
          leadingIcon: 'size-4 shrink-0',
          link: 'group lg:after:absolute lg:after:inset-y-0 lg:after:-inset-s-2 lg:after:w-2'
        }
      }
    }
  }
})

제목 4 (Heading 4)

#### Getting started
export default defineAppConfig({
  ui: {
    prose: {
      h4: {
        slots: {
          base: 'text-lg text-highlighted font-bold mt-6 mb-2 scroll-mt-[calc(24px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(24px+var(--ui-header-height))] [&>a]:rounded-sm [&>a]:outline-primary/25 [&>a]:focus-visible:outline-3',
          link: ''
        }
      }
    }
  }
})

텍스트 서식 (Text formatting)

명확한 문단과 일관된 텍스트 서식으로 콘텐츠를 구성하면 가독성이 좋아져요.

문단 (Paragraph)

Nuxt UI provides a comprehensive collection of Vue components, composables and utilities for building modern, accessible applications with consistent design and enhanced user experience.
export default defineAppConfig({
  ui: {
    prose: {
      p: {
        base: 'my-5 leading-7 text-pretty'
      }
    }
  }
})

강조 (Strong)

**Strong text**
export default defineAppConfig({
  ui: {
    prose: {
      strong: {
        base: ''
      }
    }
  }
})

이탤릭 (Emphasis)

*Emphasized text*
export default defineAppConfig({
  ui: {
    prose: {
      em: {
        base: ''
      }
    }
  }
})

링크를 만들려면 링크 텍스트를 대괄호로 감싸고 그 뒤에 괄호 안에 URL을 적으면 돼요. 외부·내부 링크 모두 동작해요.

[Nuxt documentation](https://nuxt.com)
export default defineAppConfig({
  ui: {
    prose: {
      a: {
        base: [
          'text-primary border-b border-transparent hover:border-primary font-medium focus-visible:rounded-xs outline-primary/25 focus-visible:outline-3 focus-visible:has-[>code]:outline-0 [&>code]:border-dashed [&>code]:outline-primary/25 focus-visible:[&>code]:outline-3 hover:[&>code]:border-primary hover:[&>code]:text-primary focus-visible:[&>code]:border-primary focus-visible:[&>code]:text-primary',
          'transition-colors [&>code]:transition-colors'
        ]
      }
    }
  }
})

인용 (Blockquotes)

인용문은 중요한 정보나 인용을 강조할 때 사용해요.

> Nuxt UI automatically adapts to your theme settings, ensuring consistent typography across your entire application.
export default defineAppConfig({
  ui: {
    prose: {
      blockquote: {
        base: 'border-s-4 border-accented ps-4 italic'
      }
    }
  }
})

가로 구분선 (Horizontal rules)

가로 구분선으로 콘텐츠 섹션을 시각적으로 분리할 수 있어요.

---
export default defineAppConfig({
  ui: {
    prose: {
      hr: {
        base: 'border-t border-default my-12'
      }
    }
  }
})

더 알아보기 (Learn more)