@se-studio/markdown-renderer 1.0.109 → 1.0.112

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/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @se-studio/markdown-renderer
2
2
 
3
+ ## 1.0.112
4
+
5
+ ### Patch Changes
6
+
7
+ - Version bump: patch for changed packages
8
+ - Updated dependencies
9
+ - @se-studio/contentful-rest-api@1.0.155
10
+ - @se-studio/core-data-types@1.0.148
11
+
12
+ ## 1.0.111
13
+
14
+ ### Patch Changes
15
+
16
+ - Version bump: patch for changed packages
17
+ - Updated dependencies
18
+ - @se-studio/contentful-rest-api@1.0.154
19
+ - @se-studio/core-data-types@1.0.147
20
+
21
+ ## 1.0.110
22
+
23
+ ### Patch Changes
24
+
25
+ - Version bump: patch for changed packages
26
+ - Updated dependencies
27
+ - @se-studio/contentful-rest-api@1.0.153
28
+ - @se-studio/core-data-types@1.0.146
29
+
3
30
  ## 1.0.109
4
31
 
5
32
  ### Patch Changes
package/docs/llms.md ADDED
@@ -0,0 +1,102 @@
1
+ # @se-studio/markdown-renderer — LLM Reference
2
+
3
+ Converts Contentful CMS entries to Markdown. Used primarily for search indexing and LLM ingestion pipelines. Also generates `llms.txt` site indexes per the llmstxt.org spec.
4
+
5
+ ## MarkdownConverter — convert a single entry
6
+
7
+ ```ts
8
+ import { MarkdownConverter } from '@se-studio/markdown-renderer';
9
+
10
+ const converter = new MarkdownConverter({
11
+ contentfulConfig, // ContentfulConfig from @se-studio/contentful-rest-api
12
+ urlCalculators, // UrlCalculators — functions to build hrefs from slugs
13
+ });
14
+
15
+ // Convert a page, article, or person to Markdown
16
+ const markdown = await converter.convert({ type: 'page', slug: 'home' });
17
+ // Returns string of Markdown, or null if not found
18
+ ```
19
+
20
+ ## MarkdownExporter — export all content
21
+
22
+ ```ts
23
+ import { MarkdownExporter } from '@se-studio/markdown-renderer';
24
+
25
+ const exporter = new MarkdownExporter({
26
+ contentfulConfig,
27
+ urlCalculators,
28
+ });
29
+
30
+ // Fetch raw content data for a specific entry
31
+ const contentData = await exporter.fetchContent('page', 'home', { preview: false });
32
+
33
+ // Export all pages/articles to Markdown files (used for static export)
34
+ await exporter.exportAll({ outputDir: './public/markdown' });
35
+ ```
36
+
37
+ ## LLMs.txt Generation
38
+
39
+ Generates a machine-readable site index in the llmstxt.org format:
40
+
41
+ ```ts
42
+ import { generateLlmsTxt, generateMarkdownIndex } from '@se-studio/markdown-renderer';
43
+
44
+ // Generate llms.txt content (links to all markdown pages)
45
+ const llmsTxt = generateLlmsTxt({
46
+ title: 'My Site',
47
+ description: 'Site description',
48
+ links: markdownLinks,
49
+ });
50
+
51
+ // Generate a markdown index of all content
52
+ const index = generateMarkdownIndex({
53
+ pages: allPageLinks,
54
+ articles: allArticleLinks,
55
+ urlCalculators,
56
+ });
57
+ ```
58
+
59
+ ## URL Builder Helpers
60
+
61
+ ```ts
62
+ import { buildMarkdownLinksFromAppLinks, toMarkdownUrl } from '@se-studio/markdown-renderer';
63
+
64
+ // Convert a page/article href to a markdown URL
65
+ const mdUrl = toMarkdownUrl('/blog/my-post'); // → '/markdown/blog/my-post'
66
+
67
+ // Build markdown link list from Contentful link arrays
68
+ const links = buildMarkdownLinksFromAppLinks({
69
+ pageLinks: allPageLinks,
70
+ articleLinks: allArticleLinks,
71
+ urlCalculators,
72
+ });
73
+ ```
74
+
75
+ ## Markdown API Routes (Next.js)
76
+
77
+ ```ts
78
+ import { resolveMarkdownParams } from '@se-studio/markdown-renderer';
79
+
80
+ // In app/api/markdown/[...params]/route.ts:
81
+ export async function GET(request: Request, { params }: { params: { params: string[] } }) {
82
+ const { type, slug } = resolveMarkdownParams(params.params);
83
+ // type: 'page' | 'article' | etc.
84
+ // slug: the content slug
85
+ }
86
+ ```
87
+
88
+ ## ContentData Type
89
+
90
+ ```ts
91
+ import type { ContentData } from '@se-studio/markdown-renderer';
92
+
93
+ // Used internally by both MarkdownConverter and the search package
94
+ // Contains the raw fetched content + extracted text
95
+ ```
96
+
97
+ ## When to Use
98
+
99
+ - **Search indexing**: `MarkdownExporter.fetchContent` is called by `@se-studio/search`'s `rebuildSearchIndex`
100
+ - **LLM ingestion**: use `MarkdownConverter.convert` to turn CMS pages into readable Markdown
101
+ - **Static exports**: expose `/markdown/*` routes so LLMs can crawl the site as Markdown
102
+ - **llms.txt**: expose `/llms.txt` with `generateLlmsTxt` for llmstxt.org discovery
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@se-studio/markdown-renderer",
3
- "version": "1.0.109",
3
+ "version": "1.0.112",
4
4
  "description": "Markdown renderer for Contentful content",
5
5
  "repository": {
6
6
  "type": "git",
@@ -23,14 +23,15 @@
23
23
  },
24
24
  "files": [
25
25
  "dist",
26
- "*.md"
26
+ "*.md",
27
+ "docs"
27
28
  ],
28
29
  "dependencies": {
29
30
  "@contentful/rich-text-types": "^17.2.7",
30
31
  "html-entities": "^2.6.0",
31
32
  "js-yaml": "^4.1.1",
32
- "@se-studio/contentful-rest-api": "1.0.152",
33
- "@se-studio/core-data-types": "1.0.145"
33
+ "@se-studio/contentful-rest-api": "1.0.155",
34
+ "@se-studio/core-data-types": "1.0.148"
34
35
  },
35
36
  "devDependencies": {
36
37
  "@biomejs/biome": "^2.4.15",