Skip to content

Commit 2aa85ed

Browse files
committed
feat: serve pages as markdown and update llms.txt (#2249)
- Install docusaurus-markdown-source-plugin to inject "Open Markdown" dropdown on every /docs/ page linking to currentPath + .md - Add nginx location block to intercept .md URLs, strip the extension, and proxy to developers.stellar.org with Accept: text/markdown header - Update static/llms.txt to document the .md URL scheme and Accept header
1 parent 2b66849 commit 2aa85ed

File tree

5 files changed

+29
-0
lines changed

5 files changed

+29
-0
lines changed

docusaurus.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ const config: Config = {
8484
],
8585
'./src/plugins/route-export/index.ts',
8686
'./src/plugins/analytics-module/index.ts',
87+
'docusaurus-markdown-source-plugin',
8788
],
8889
markdown: {
8990
mermaid: true,

nginx/nginx.conf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,12 @@ http {
3333
location /404.html {
3434
add_header 'Cache-Control' 'no-store' always;
3535
}
36+
location ~* ^(.+)\.md$ {
37+
resolver 1.1.1.1 valid=300s;
38+
proxy_pass https://developers.stellar.org$1;
39+
proxy_set_header Accept "text/markdown";
40+
proxy_set_header Host "developers.stellar.org";
41+
proxy_ssl_server_name on;
42+
}
3643
}
3744
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"@stellar/open-rpc-docs-react": "^0.2.1",
5050
"ajv": "^8.18.0",
5151
"clsx": "^2.1.1",
52+
"docusaurus-markdown-source-plugin": "^2.0.1",
5253
"docusaurus-plugin-openapi-docs": "4.5.1",
5354
"docusaurus-plugin-sass": "^0.2.6",
5455
"docusaurus-plugin-sentry": "^2.1.0",

static/llms.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Stellar Developer Documentation
22
Stellar is a layer-1 open-source, decentralized, peer-to-peer blockchain network that provides a framework for developers to create applications, issue assets, write smart contracts, and connect to existing financial rails. Stellar is designed to enable creators, innovators, and developers to build projects on the network that can interoperate with each other.
33

4+
Each documentation page is available as clean markdown by appending `.md` to the URL
5+
(e.g. `https://developers.stellar.org/docs/build/smart-contracts/overview.md`).
6+
Alternatively, send an `Accept: text/markdown` request header to any page URL to receive markdown without modifying the URL.
7+
48

59
[Build](https://developers.stellar.org/docs/build)
610

yarn.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6526,6 +6526,13 @@ dns-packet@^5.2.2:
65266526
dependencies:
65276527
"@leichtgewicht/ip-codec" "^2.0.1"
65286528

6529+
docusaurus-markdown-source-plugin@^2.0.1:
6530+
version "2.0.1"
6531+
resolved "https://registry.yarnpkg.com/docusaurus-markdown-source-plugin/-/docusaurus-markdown-source-plugin-2.0.1.tgz#6c3fa0df4ec1f2230922ff04af3a62ef6ba8b156"
6532+
integrity sha512-RiKMi+SDlrQQ25VkbOvz9M7glH9lcpAsz0WzepilnC2MgXA6uLNpl7PezrlY6nvW7MnhB4Aakwwonz+0WVBQAQ==
6533+
dependencies:
6534+
fs-extra "^11.0.0"
6535+
65296536
docusaurus-plugin-openapi-docs@4.5.1:
65306537
version "4.5.1"
65316538
resolved "https://registry.yarnpkg.com/docusaurus-plugin-openapi-docs/-/docusaurus-plugin-openapi-docs-4.5.1.tgz#b1133b0e03e284a6ade47fa2c3fcf5eab8ec6911"
@@ -7415,6 +7422,15 @@ fs-extra@^10.0.0, fs-extra@^10.1.0:
74157422
jsonfile "^6.0.1"
74167423
universalify "^2.0.0"
74177424

7425+
fs-extra@^11.0.0:
7426+
version "11.3.3"
7427+
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.3.3.tgz#a27da23b72524e81ac6c3815cc0179b8c74c59ee"
7428+
integrity sha512-VWSRii4t0AFm6ixFFmLLx1t7wS1gh+ckoa84aOeapGum0h+EZd1EhEumSB+ZdDLnEPuucsVB9oB7cxJHap6Afg==
7429+
dependencies:
7430+
graceful-fs "^4.2.0"
7431+
jsonfile "^6.0.1"
7432+
universalify "^2.0.0"
7433+
74187434
fs-extra@^11.1.1, fs-extra@^11.2.0:
74197435
version "11.3.0"
74207436
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-11.3.0.tgz#0daced136bbaf65a555a326719af931adc7a314d"

0 commit comments

Comments
 (0)