Repository navigation
feat: Markdownレンダリング機能を実装 - #24
Merged
Merged
Conversation
インタラクティブモードでMarkdownを美しく表示するためのレンダリング機能を実装しました。
依存ライブラリ:
- github.com/charmbracelet/glamour v0.10.0 を追加
実装内容:
- internal/render/markdown.go を作成
- RenderMarkdown() 関数を実装
- glamour.NewTermRenderer を使用
- AutoStyle(自動でターミナルテーマに合わせる)
- WordWrap(指定幅で折り返し)
- エラー時は生テキストでフォールバック
- RenderMarkdownPreview() 関数を実装
- プレビュー用に高さ制限付き
- maxLines を超えたら「↓ 続きあり」を表示
- internal/render/markdown_test.go でユニットテストを作成
- シンプルなテキスト
- 見出し
- リスト
- コードブロック
- 複合的なMarkdown
- プレビュー機能(切り詰めあり/なし)
- エラーハンドリング
Markdownレンダリング機能:
- 見出し(太字・色付き)
- コードブロック(シンタックスハイライト)
- リスト・チェックボックス
- リンク(下線付き)
- 引用・太字・斜体
受け入れ基準:
✅ Markdownが色付きでレンダリングされる
✅ コードブロックがシンタックスハイライトされる
✅ 指定幅で折り返される
✅ レンダリング失敗時でもエラーにならない
Closes #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
インタラクティブモードでMarkdownを美しく表示するためのレンダリング機能を実装しました。
関連Issue
Closes #10
依存ライブラリの追加
github.com/charmbracelet/glamour v0.10.0変更内容
新規ファイル
internal/render/markdown.go
RenderMarkdown(content string, width int) (string, error)RenderMarkdownPreview(content string, width, maxLines int) (string, error)internal/render/markdown_test.go
Markdownレンダリング機能
使用例
テスト方法
受け入れ基準
チェックリスト
go fmt)