takumi-markdown 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # Takumi Markdown (匠)
2
+
3
+ Beautiful Markdown renderer for React with Japanese typography optimization and ruby notation support.
4
+
5
+ ## Features
6
+
7
+ - 🎨 **Beautiful Typography** - Optimized for Japanese (CJK) text
8
+ - 📝 **Ruby Notation** - Support for `|親文字《ルビ》` syntax (小説家になろう/カクヨム style)
9
+ - 📋 **Frontmatter** - YAML frontmatter parsing and display
10
+ - ✨ **GFM Support** - Tables, checkboxes, and more
11
+ - 🎯 **Syntax Highlighting** - Code blocks with highlight.js
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install takumi-markdown
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```tsx
22
+ import { MarkdownRenderer } from 'takumi-markdown';
23
+ import 'takumi-markdown/styles.css';
24
+
25
+ function App() {
26
+ const markdown = `
27
+ # タイトル
28
+
29
+ これは**美しい**マークダウンです。
30
+
31
+ |山田太郎《やまだたろう》は旅に出た。
32
+ `;
33
+
34
+ return <MarkdownRenderer content={markdown} />;
35
+ }
36
+ ```
37
+
38
+ ## Ruby Notation
39
+
40
+ Supports 小説家になろう / カクヨム style ruby (furigana) notation:
41
+
42
+ | Syntax | Result |
43
+ |--------|--------|
44
+ | `|漢字《かんじ》` | <ruby>漢字<rt>かんじ</rt></ruby> |
45
+ | `漢字《かんじ》` | <ruby>漢字<rt>かんじ</rt></ruby> (auto-detect) |
46
+
47
+ ## API
48
+
49
+ ### `<MarkdownRenderer />`
50
+
51
+ | Prop | Type | Description |
52
+ |------|------|-------------|
53
+ | `content` | `string` | Markdown content to render |
54
+
55
+ ### `remarkRuby`
56
+
57
+ Remark plugin for ruby notation. Exported for advanced users who want to use it with their own react-markdown setup.
58
+
59
+ ```tsx
60
+ import remarkRuby from 'takumi-markdown/remarkRuby';
61
+ ```
62
+
63
+ ## License
64
+
65
+ MIT
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import '../styles/typography.css';
3
+ import 'highlight.js/styles/github.css';
4
+ export interface MarkdownRendererProps {
5
+ content: string;
6
+ }
7
+ export declare const MarkdownRenderer: React.FC<MarkdownRendererProps>;
@@ -0,0 +1,3 @@
1
+ export { MarkdownRenderer } from '../components/MarkdownRenderer';
2
+ export type { MarkdownRendererProps } from '../components/MarkdownRenderer';
3
+ export { default as remarkRuby } from '../plugins/remarkRuby';
@@ -0,0 +1,16 @@
1
+ import type { Plugin } from 'unified';
2
+ import type { Root } from 'mdast';
3
+ /**
4
+ * Remark plugin to convert ruby notation to HTML ruby elements
5
+ *
6
+ * Supports the following formats (compatible with 小説家になろう / カクヨム):
7
+ * - |親文字《ルビ》 (explicit delimiter with full-width pipe)
8
+ * - |親文字《ルビ》 (explicit delimiter with half-width pipe)
9
+ * - 漢字《かんじ》 (auto-detect kanji)
10
+ *
11
+ * @example
12
+ * Input: |山田太郎《やまだたろう》
13
+ * Output: <ruby>山田太郎<rt>やまだたろう</rt></ruby>
14
+ */
15
+ declare const remarkRuby: Plugin<[], Root>;
16
+ export default remarkRuby;