Skip to content

Commit 9f781d4

Browse files
authored
docs: enable llms.txt for docs (#976)
## 📜 Description Added generation of `llms.txt`. ## 💡 Motivation and Context In reality people already use less and less classic search and more and more trust to LLMs. However current LLMs struggle to index classic websites and unofficial standard is usage of `llms.txt` - markdown files that contains documentation. To continuously generate llms files I decided to use a special plugin that does. Maybe in future I'll switch to official docusaurus plugin, but now let's not waste time and implement something to make docs LLMs friendly. ## 📢 Changelog <!-- High level overview of important changes --> <!-- For example: fixed status bar manipulation; added new types declarations; --> <!-- If your changes don't affect one of platform/language below - then remove this platform/language --> ### Docs - continuously generate `llms.txt`; - added patch-package; - fixed broken anchors; ## 🤔 How Has This Been Tested? Preview will not have LLMs integration (for now), so the only way to test is to merge it and verify deploy. ## 📸 Screenshots (if appropriate): <img width="266" alt="image" src="https://github.com/user-attachments/assets/4e26ca9f-1882-4440-9158-8534a05f8b64" /> ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
1 parent 371cf7b commit 9f781d4

File tree

8 files changed

+478
-16
lines changed

8 files changed

+478
-16
lines changed

cspell.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,9 @@
155155
"HKLM",
156156
"xcassets",
157157
"appiconset",
158-
"taskdefs"
158+
"taskdefs",
159+
"llms",
160+
"signalwire"
159161
],
160162
"ignorePaths": [
161163
"node_modules",

docs/docs/guides/interactive-keyboard.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ First of all let's consider a simple example and layout for typical chat applica
3939

4040
### Adding `KeyboardGestureArea`
4141

42-
To make interactive dismissing work on Android we need to add `KeyboardGestureArea` view. This view will track all gestures and will control the keyboard positioning. To customize the way how the keyboard will be dismissed you can specify `interpolator` [prop](../api/keyboard-gesture-area.md#interpolator).
42+
To make interactive dismissing work on Android we need to add `KeyboardGestureArea` view. This view will track all gestures and will control the keyboard positioning. To customize the way how the keyboard will be dismissed you can specify `interpolator` [prop](../api/keyboard-gesture-area.md#interpolator-).
4343

4444
In order to recognize all gestures on a `ScrollView` we need to wrap a `ScrollView` within `KeyboardGestureArea`:
4545

docs/docusaurus.config.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,24 @@ const config = {
107107
}),
108108
],
109109
],
110+
plugins: [
111+
[
112+
"@signalwire/docusaurus-plugin-llms-txt",
113+
{
114+
// Plugin options
115+
depth: 3,
116+
siteTitle: "react-native0keyboard-controller",
117+
siteDescription:
118+
"Documentation for react-native-keyboard-controller. Package that allows to control each frame of keyboard movement in react native.",
119+
content: {
120+
includeBlog: true,
121+
includePages: true,
122+
excludeRoutes: ["**/docs/1.*/**"],
123+
enableMarkdownFiles: true,
124+
},
125+
},
126+
],
127+
],
110128

111129
themeConfig:
112130
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */

docs/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@
1313
"https": "HTTPS=true SSL_CRT_FILE=localhost.pem SSL_KEY_FILE=localhost-key.pem docusaurus start",
1414
"write-translations": "docusaurus write-translations",
1515
"write-heading-ids": "docusaurus write-heading-ids",
16-
"typescript": "tsc"
16+
"typescript": "tsc",
17+
"postinstall": "patch-package"
1718
},
1819
"dependencies": {
1920
"@docusaurus/core": "3.4.0",
2021
"@docusaurus/preset-classic": "3.4.0",
2122
"@mdx-js/react": "^3.0.0",
23+
"@signalwire/docusaurus-plugin-llms-txt": "^1.0.1",
2224
"clsx": "^2.0.0",
2325
"lottie-react": "^2.4.0",
2426
"prism-react-renderer": "^2.3.0",
@@ -34,6 +36,7 @@
3436
"@playwright/test": "^1.46.0",
3537
"cheerio": "^1.0.0-rc.12",
3638
"markdownlint-cli2": "^0.12.1",
39+
"patch-package": "^8.0.0",
3740
"typescript": "^5.2.2"
3841
},
3942
"browserslist": {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/node_modules/@signalwire/docusaurus-plugin-llms-txt/lib/processing/route-processor.js b/node_modules/@signalwire/docusaurus-plugin-llms-txt/lib/processing/route-processor.js
2+
index 9c92f64..11d3f6f 100644
3+
--- a/node_modules/@signalwire/docusaurus-plugin-llms-txt/lib/processing/route-processor.js
4+
+++ b/node_modules/@signalwire/docusaurus-plugin-llms-txt/lib/processing/route-processor.js
5+
@@ -27,7 +27,7 @@ async function processSingleRoute(route, cachedRoute, config, directories, logge
6+
return {};
7+
}
8+
try {
9+
- const fullHtmlPath = path.join(directories.docsDir, cachedRoute.htmlPath);
10+
+ const fullHtmlPath = path.join(directories.docsDir, cachedRoute.htmlPath.replace("react-native-keyboard-controller/", "").replace("/index.html", ".html"));
11+
const effectiveConfig = getEffectiveConfigForRoute(route.path, config);
12+
const doc = await processHtmlFileWithContext(fullHtmlPath, route.path, effectiveConfig, directories.mdOutDir, logger, siteUrl, outDir);
13+
if (doc) {

docs/versioned_docs/version-1.16.0/guides/interactive-keyboard.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ First of all let's consider a simple example and layout for typical chat applica
3939

4040
### Adding `KeyboardGestureArea`
4141

42-
To make interactive dismissing work on Android we need to add `KeyboardGestureArea` view. This view will track all gestures and will control the keyboard positioning. To customize the way how the keyboard will be dismissed you can specify `interpolator` [prop](../api/keyboard-gesture-area.md#interpolator).
42+
To make interactive dismissing work on Android we need to add `KeyboardGestureArea` view. This view will track all gestures and will control the keyboard positioning. To customize the way how the keyboard will be dismissed you can specify `interpolator` [prop](../api/keyboard-gesture-area.md#interpolator-).
4343

4444
In order to recognize all gestures on a `ScrollView` we need to wrap a `ScrollView` within `KeyboardGestureArea`:
4545

docs/versioned_docs/version-1.17.0/guides/interactive-keyboard.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ First of all let's consider a simple example and layout for typical chat applica
3939

4040
### Adding `KeyboardGestureArea`
4141

42-
To make interactive dismissing work on Android we need to add `KeyboardGestureArea` view. This view will track all gestures and will control the keyboard positioning. To customize the way how the keyboard will be dismissed you can specify `interpolator` [prop](../api/keyboard-gesture-area.md#interpolator).
42+
To make interactive dismissing work on Android we need to add `KeyboardGestureArea` view. This view will track all gestures and will control the keyboard positioning. To customize the way how the keyboard will be dismissed you can specify `interpolator` [prop](../api/keyboard-gesture-area.md#interpolator-).
4343

4444
In order to recognize all gestures on a `ScrollView` we need to wrap a `ScrollView` within `KeyboardGestureArea`:
4545

0 commit comments

Comments
 (0)