Skip to content

feat(mdx): 헤딩 앵커 링크 추가 및 h4~h6 등록#66

Merged
emayom merged 2 commits into
mainfrom
feat/#65-heading-anchor
Jun 29, 2026
Merged

feat(mdx): 헤딩 앵커 링크 추가 및 h4~h6 등록#66
emayom merged 2 commits into
mainfrom
feat/#65-heading-anchor

Conversation

@emayom

@emayom emayom commented Jun 29, 2026

Copy link
Copy Markdown
Owner

개요

h2~h6 헤딩에 hover 시 링크 아이콘 표시, 클릭 시 섹션 URL을 클립보드에 복사한다.

관련 이슈

Closes #65

변경 유형

  • feat

변경 내용

  • rehype-autolink-headings 설치 및 mdx-options.ts 등록 (rehype-slug → autolink → pretty-code 순서)
  • SVG 링크 아이콘 hast 노드로 삽입 (behavior: append)
  • HeadingAnchor 클라이언트 컴포넌트 신규 생성
    • hover: 아이콘 노출 + "링크를 제목에 복사" 툴팁
    • click: URL 클립보드 복사 + "복사되었습니다!" 툴팁 (2초 후 복귀)
    • 한글 fragment encodeURI 인코딩 적용
  • mdxComponents a 컴포넌트: heading-anchor 클래스 분기로 HeadingAnchor 위임
  • h2/h3: group relative 추가
  • h4/h5/h6 신규 등록 (타이포그래피 스케일 적용)

체크리스트

코드 품질

  • npm run build 통과
  • npm run lint 통과
  • npx tsc --noEmit 통과

기능 검증

  • h2~h6 hover 시 링크 아이콘 표시 확인
  • 클릭 시 클립보드 복사 + 툴팁 전환 확인
  • 한글 헤딩 URL 인코딩 확인
  • 다크모드 확인

emayom and others added 2 commits June 29, 2026 17:14
- rehype-autolink-headings 추가: h2~h6 전체에 hover 시 링크 아이콘 자동 삽입
- HeadingAnchor 클라이언트 컴포넌트: 클립보드 복사 + 툴팁 전환
- mdxComponents a 컴포넌트: heading-anchor 클래스 분기로 인라인 링크와 구분
- h2/h3: group relative 추가로 앵커 hover 제어
- h4/h5/h6 신규 등록 (타이포그래피 스케일 적용)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
한글 헤딩의 fragment를 encodeURI로 퍼센트 인코딩하여
공유 시 URL 호환성 보장

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Jun 29, 2026 8:17am

@emayom emayom merged commit 5d8013c into main Jun 29, 2026
3 checks passed
@emayom emayom deleted the feat/#65-heading-anchor branch June 29, 2026 08:21
@emayom emayom added the enhancement New feature or request label Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(mdx): 헤딩 앵커 링크 — 클릭 시 URL 클립보드 복사

1 participant