-
Notifications
You must be signed in to change notification settings - Fork 8
Add markdown serving for AI-readable documentation #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
Claude
wants to merge
2
commits into
main
Choose a base branch
from
claude/serve-markdown-doc-pages
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| name: Build and Deploy Jekyll Site | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ "main" ] | ||
| pull_request: | ||
| branches: [ "main" ] | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
|
|
||
| concurrency: | ||
| group: "pages" | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Ruby | ||
| uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: '3.1' | ||
| bundler-cache: true | ||
|
|
||
| - name: Setup Pages | ||
| id: pages | ||
| uses: actions/configure-pages@v5 | ||
|
|
||
| - name: Build with Jekyll | ||
| run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" | ||
| env: | ||
| JEKYLL_ENV: production | ||
|
|
||
| - name: Upload artifact | ||
| uses: actions/upload-pages-artifact@v3 | ||
|
|
||
| deploy: | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| if: github.ref == 'refs/heads/main' | ||
| steps: | ||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,7 @@ | ||
| _site/ | ||
| *.dic | ||
| Gemfile.lock | ||
| .bundle/ | ||
| vendor/ | ||
| .jekyll-cache/ | ||
| .jekyll-metadata |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # AI-Readable Documentation | ||
|
|
||
| This documentation site is designed to be AI-friendly by providing clean markdown versions of all documentation pages. | ||
|
|
||
| ## Features | ||
|
|
||
| ### 1. Markdown URL Endpoints | ||
|
|
||
| For every documentation page, a markdown version is available by appending `.md` to the URL. | ||
|
|
||
| **Examples:** | ||
| - HTML: `https://docs.falkordb.com/` → Markdown: `https://docs.falkordb.com/.md` | ||
| - HTML: `https://docs.falkordb.com/getting-started/clients` → Markdown: `https://docs.falkordb.com/getting-started/clients.md` | ||
| - HTML: `https://docs.falkordb.com/cypher/indexing/vector-index` → Markdown: `https://docs.falkordb.com/cypher/indexing/vector-index.md` | ||
|
|
||
| ### 2. Clean Markdown Output | ||
|
|
||
| The markdown versions are stripped of: | ||
| - Navigation menus | ||
| - Sidebars | ||
| - Footers | ||
| - Theme elements | ||
| - JavaScript and styling | ||
|
|
||
| Only the core documentation content is included, making it optimal for AI tools to parse and understand. | ||
|
|
||
| ### 3. Content Structure | ||
|
|
||
| Each markdown page includes: | ||
| - Page title (as H1) | ||
| - Page description (if available) | ||
| - Main content body | ||
|
|
||
| ## Implementation Details | ||
|
|
||
| ### Jekyll Plugin | ||
|
|
||
| A custom Jekyll plugin (`_plugins/markdown_generator.rb`) automatically generates `.md` versions of all documentation pages during the build process. | ||
|
|
||
| ### Clean Layout | ||
|
|
||
| The `_layouts/markdown.html` layout renders content without any theme-specific elements, providing clean, focused markdown output. | ||
|
|
||
| ### Build Process | ||
|
|
||
| The site uses a custom GitHub Actions workflow (`.github/workflows/pages.yml`) that: | ||
| 1. Builds the Jekyll site with custom plugins enabled | ||
| 2. Generates both HTML and markdown versions | ||
| 3. Deploys to GitHub Pages | ||
|
|
||
| ## For AI Tools | ||
|
|
||
| AI tools can: | ||
| 1. Directly request the `.md` version of any page | ||
| 2. Parse clean markdown without HTML noise | ||
| 3. Access structured documentation content efficiently | ||
|
|
||
| ## Note on Content Negotiation | ||
|
|
||
| While the Accept header approach (`Accept: text/markdown`) would be ideal, GitHub Pages' static hosting doesn't support server-side content negotiation. The `.md` URL suffix provides a reliable alternative that works with all clients. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| source "https://rubygems.org" | ||
|
|
||
| gem "jekyll", "~> 4.3" | ||
| gem "just-the-docs", "~> 0.10" | ||
|
|
||
| group :jekyll_plugins do | ||
| gem "jekyll-sitemap" | ||
| gem "jekyll-redirect-from" | ||
| end | ||
|
|
||
| platforms :mingw, :x64_mingw, :mswin, :jruby do | ||
| gem "tzinfo", ">= 1", "< 3" | ||
| gem "tzinfo-data" | ||
| end | ||
|
|
||
| gem "wdm", "~> 0.1", :install_if => Gem.win_platform? | ||
| gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby] |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| --- | ||
| # Clean markdown layout for AI tools | ||
| # Strips navigation, footer, and other non-content elements | ||
| # Outputs plain text content type for markdown | ||
| --- | ||
| {% if page.title %}# {{ page.title }} | ||
|
|
||
| {% endif %}{% if page.description %}{{ page.description }} | ||
|
|
||
| {% endif %}{{ content | strip }} |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # Jekyll plugin to generate .md versions of documentation pages for AI tools | ||
| # This creates clean markdown files at URL.md for each documentation page | ||
|
|
||
| module Jekyll | ||
| class MarkdownPageGenerator < Generator | ||
| safe true | ||
| priority :lowest | ||
|
|
||
| def generate(site) | ||
| # Collect all pages that should have .md versions | ||
| pages_to_process = [] | ||
|
|
||
| site.pages.each do |page| | ||
| # Only process markdown source files | ||
| next unless page.name.end_with?('.md') | ||
|
|
||
| # Skip if already a .md URL endpoint | ||
| next if page.url.end_with?('.md') | ||
|
|
||
| # Skip special files | ||
| next if page.name.start_with?('_') | ||
|
|
||
| pages_to_process << page | ||
| end | ||
|
|
||
| # Generate .md versions | ||
| pages_to_process.each do |source_page| | ||
| md_page = MarkdownPage.new(site, source_page) | ||
| site.pages << md_page | ||
| end | ||
| end | ||
| end | ||
|
|
||
| class MarkdownPage < Page | ||
| def initialize(site, source_page) | ||
| @site = site | ||
| @base = site.source | ||
| @dir = File.dirname(source_page.relative_path) | ||
|
|
||
| # Generate unique name for .md version | ||
| base_name = File.basename(source_page.name, '.md') | ||
| @name = "#{base_name}.source.md" | ||
|
|
||
| # Process the filename | ||
| self.process(@name) | ||
|
|
||
| # Copy and modify data | ||
| self.data = {} | ||
| self.data['layout'] = 'markdown' | ||
| self.data['title'] = source_page.data['title'] | ||
| self.data['description'] = source_page.data['description'] | ||
|
|
||
| # Set permalink to be original_url.md | ||
| base_url = source_page.url.chomp('/') | ||
| base_url = '/' if base_url.empty? | ||
| self.data['permalink'] = "#{base_url}.md" | ||
|
|
||
| # Get the content | ||
| self.content = source_page.content | ||
| end | ||
| end | ||
| end |
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.
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium