Skip to content

add markdown exports for llms#194

Merged
skatkov merged 4 commits intomainfrom
feat/markdown-for-llms
Apr 9, 2026
Merged

add markdown exports for llms#194
skatkov merged 4 commits intomainfrom
feat/markdown-for-llms

Conversation

@skatkov
Copy link
Copy Markdown
Owner

@skatkov skatkov commented Apr 9, 2026

Summary

  • generate clean Markdown copies of Jekyll pages under .md URLs so LLM agents can read the source docs instead of themed HTML
  • advertise the Markdown pages from HTML with rel=\"alternate\" and add a root llms.txt index for discovery
  • rewrite internal Markdown links to prefer other Markdown exports and strip front matter plus Jekyll-only attribute markup from the exported files

Testing

  • bundle exec jekyll build

Stanislav (Stas) Katkov added 4 commits April 10, 2026 00:53
Expose Markdown versions of Jekyll pages and an llms.txt index so agents can prefer the source docs over rendered HTML.
Keep the site glue limited to head discovery while the Jekyll plugin owns markdown exports and the generated llms.txt output.
Move llms.txt content and section rules into site config so the plugin can be extracted without carrying DevTUI-specific copy or grouping logic.
Let the plugin infer llms.txt sections from existing page metadata so most sites only need to enable it and optionally rename the root section.
@skatkov skatkov force-pushed the feat/markdown-for-llms branch from a8e0bb5 to ae85e77 Compare April 9, 2026 23:46
@skatkov skatkov requested a review from Copilot April 9, 2026 23:49
@skatkov skatkov merged commit 6823a11 into main Apr 9, 2026
18 checks passed
@skatkov skatkov deleted the feat/markdown-for-llms branch April 9, 2026 23:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Jekyll plugin that generates clean, source-oriented Markdown exports of site pages (plus a discoverable llms.txt index) to make documentation easier for LLM agents to consume than themed HTML.

Changes:

  • Introduces a Jekyll plugin to export .md versions of Markdown-backed pages, stripping front matter / Jekyll-specific attribute markup and rewriting internal links to prefer Markdown exports.
  • Adds rel="alternate" discovery links from HTML pages to their Markdown export URLs.
  • Enables automatic llms.txt generation via site config.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
site/_plugins/markdown_for_llms.rb Implements Markdown export generation, link rewriting, and llms.txt generation + site hook wiring.
site/_includes/head_custom.html Publishes Markdown export URLs via <link rel="alternate" type="text/markdown">.
site/_config.yml Enables llms.txt generation and sets the default root section title.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +60 to +70
canonical = normalize_site_path(page.url)
map[canonical] = export_url

if canonical == '/'
map['/index.html'] = export_url
elsif canonical.end_with?('/')
map[canonical.chomp('/')] = export_url
map[normalize_site_path(File.join(canonical, 'index.html'))] = export_url
elsif canonical.end_with?('.html')
map[canonical.sub(/\.html\z/, '')] = export_url
end
Copy link

Copilot AI Apr 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In build_link_map, canonical is already passed through normalize_site_path, which (via Pathname#cleanpath) strips trailing slashes from paths (except /). As a result, the elsif canonical.end_with?('/') branch is effectively unreachable and mappings like /some/section/index.html won't be added for “pretty” URLs. This can prevent rewrite_markdown_links from rewriting links that target index.html pages. Consider checking page.url.end_with?('/') before normalization and/or explicitly adding a mapping for "#{canonical}/index.html" when the original URL ends with /.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot apply changes based on this feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants