jekyll-llms 0.1.0 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23293734537766446bec10323faae85e54243da602e80bca5d8675feffff8abd
4
- data.tar.gz: 33b4069fbc9e69e04305f33f487788d67e279a2f60842d789400d7f43de87c20
3
+ metadata.gz: 48ccdbd84d3c01d8fc4efa05141ab0501416004faf3185fd0e613488ef98accb
4
+ data.tar.gz: 7d116b7037ffd8a96cc7b05ce5f3b2990b772a183e1c4d795f5f6c91b9c5d814
5
5
  SHA512:
6
- metadata.gz: a0e1ad5425441b17e99e316762b097c2f00f8b259cf4b9742ce9440d3712d740b51a160d95317459b94677dcd4fc3a1262e3e5642dba949394216c1af3a1101c
7
- data.tar.gz: fac4f5e71fce6d09cfc476ac61fe236cfb00fa181d90be85eaa2cf0f17fbf0d62c9804ef11abfc36ae0618acc0b559ac7cc7b13331ed050a87b86b7d3e9ec758
6
+ metadata.gz: fc07ec9876c91ba823fd05334393c7f713a58460b9e5d6bffe605b6dbc67fc76c5f8c0e25dff4e4485970ea30148d3fb6f3ba218632ec98d90d1a320e6b4f2cd
7
+ data.tar.gz: fa433ac872fdf80b6f87152209fe06ce7202b2dfadfc8540028bc5f2892c7ca38245a1dee3d4e024124fc4ca5097f75b6ff93314a7b8aab8fe081060178862ac
data/CHANGELOG.md ADDED
@@ -0,0 +1,28 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## 0.2.0
6
+
7
+ ### Fixed
8
+
9
+ - Ensure that one invalid markdown file will not block publishing of all markdown files.
10
+
11
+ ## 0.1.1
12
+
13
+ ### Changed
14
+
15
+ - Exclude `/README.md` and `/CHANGELOG.md` by default. Set `llms.exclude` to replace this list.
16
+
17
+ ### Fixed
18
+
19
+ - Copy Markdown sidecars only based off already existing Markdown files
20
+ - Keep HTML-source entries linked to their original URLs in `llms.txt` and skip Markdown alternate links for them.
21
+
22
+ ## 0.1.0 - 2026-05-03
23
+
24
+ ### Added
25
+
26
+ - Generate `llms.txt` for included pages, posts, and output collections.
27
+ - Generate Markdown source sidecars for included entries.
28
+ - Add HTML alternate links pointing to generated Markdown sidecars.
data/README.md CHANGED
@@ -24,10 +24,10 @@ plugins:
24
24
  ## Output
25
25
 
26
26
  - `/llms.txt`: Markdown index of included entries.
27
- - `*.md`: source-body sidecars for included entries.
27
+ - `*.md`: source-body sidecars for included Markdown-source entries.
28
28
  - HTML `<link rel="alternate" type="text/markdown" href="...">` tags pointing to sidecars.
29
29
 
30
- Sidecars are source bodies, not HTML-to-Markdown conversions. Front matter is removed. Liquid is rendered unless `render_with_liquid: false` is set.
30
+ Sidecars are source bodies, not HTML-to-Markdown conversions. Front matter is removed. Liquid is rendered unless `render_with_liquid: false` is set. HTML-source entries stay linked by their original URLs.
31
31
 
32
32
  ## Configuration
33
33
 
@@ -39,14 +39,16 @@ llms:
39
39
  - pages
40
40
  - posts
41
41
  exclude:
42
+ - /README.md
43
+ - /CHANGELOG.md
42
44
  - /404.html
43
45
  - /assets/**
44
46
  ```
45
47
 
46
- - `markdown`: generate sidecars, link `llms.txt` to sidecars, and add HTML alternate links. Default: `true`.
48
+ - `markdown`: generate sidecars for Markdown sources, link `llms.txt` to those sidecars, and add HTML alternate links. Default: `true`.
47
49
  - `llms_txt`: generate `/llms.txt`. Default: `true`.
48
50
  - `include`: `pages`, `posts`, and output collection names. Default: `[pages, posts]`.
49
- - `exclude`: URL, Markdown path, or source path globs. Default: `[]`.
51
+ - `exclude`: URL, Markdown path, or source path globs. Default: `[/README.md, /CHANGELOG.md]`.
50
52
 
51
53
  Per-entry opt-out:
52
54
 
@@ -7,7 +7,7 @@ module Jekyll
7
7
  "markdown" => true,
8
8
  "llms_txt" => true,
9
9
  "include" => %w[pages posts],
10
- "exclude" => [],
10
+ "exclude" => ["/README.md", "/CHANGELOG.md"],
11
11
  }.freeze
12
12
 
13
13
  def self.from_site(site)
@@ -6,6 +6,7 @@ module Jekyll
6
6
  attr_reader :item, :section, :url
7
7
 
8
8
  def initialize(site:, item:, section:)
9
+ @site = site
9
10
  @item = item
10
11
  @section = section
11
12
  @url = Url.new(site: site, item: item)
@@ -19,6 +20,10 @@ module Jekyll
19
20
  item.data.fetch("llms", true)
20
21
  end
21
22
 
23
+ def markdown_source?
24
+ markdown_extensions.include?(File.extname(item.relative_path).delete_prefix("."))
25
+ end
26
+
22
27
  def excluded_by?(patterns)
23
28
  patterns.any? do |pattern|
24
29
  url.matches?(pattern)
@@ -34,6 +39,12 @@ module Jekyll
34
39
 
35
40
  private
36
41
 
42
+ attr_reader :site
43
+
44
+ def markdown_extensions
45
+ site.config.fetch("markdown_ext", Configuration::DEFAULTS.fetch("markdown_ext")).split(",")
46
+ end
47
+
37
48
  def fallback_title
38
49
  if item.respond_to?(:basename_without_ext)
39
50
  item.basename_without_ext
@@ -3,10 +3,10 @@
3
3
  module Jekyll
4
4
  module Llms
5
5
  class Index
6
- def initialize(site:, entries:, markdown:)
6
+ def initialize(site:, entries:, url_for:)
7
7
  @site = site
8
8
  @entries = entries
9
- @markdown = markdown
9
+ @url_for = url_for
10
10
  end
11
11
 
12
12
  def content
@@ -25,7 +25,7 @@ module Jekyll
25
25
 
26
26
  private
27
27
 
28
- attr_reader :site, :entries, :markdown
28
+ attr_reader :site, :entries, :url_for
29
29
 
30
30
  def title
31
31
  site.config.fetch("title", "Jekyll Site")
@@ -36,7 +36,7 @@ module Jekyll
36
36
  end
37
37
 
38
38
  def entry_line(entry)
39
- line = "- [#{entry.title}](#{entry.url.absolute(markdown: markdown)})"
39
+ line = "- [#{entry.title}](#{url_for.call(entry)})"
40
40
  entry.description.empty? ? line : "#{line}: #{entry.description}"
41
41
  end
42
42
 
@@ -11,29 +11,49 @@ module Jekyll
11
11
  end
12
12
 
13
13
  def write
14
- write_index if config.llms_txt?
15
- if config.markdown?
16
- write_markdown
17
- write_html_links
18
- end
14
+ markdown_entries = config.markdown? ? write_markdown : []
15
+
16
+ write_index(markdown_entries) if config.llms_txt?
17
+ write_html_links(markdown_entries)
19
18
  end
20
19
 
21
20
  private
22
21
 
23
22
  attr_reader :site, :config, :entries, :files
24
23
 
25
- def write_index
26
- files.write("llms.txt", Index.new(site: site, entries: entries, markdown: config.markdown?).content)
24
+ def write_index(markdown_entries)
25
+ files.write("llms.txt", Index.new(site: site, entries: entries, url_for: index_url(markdown_entries)).content)
26
+ end
27
+
28
+ def index_url(markdown_entries)
29
+ lambda do |entry|
30
+ entry.url.absolute(markdown: markdown_entries.include?(entry))
31
+ end
27
32
  end
28
33
 
29
34
  def write_markdown
30
- entries.each do |entry|
31
- files.write(entry.url.markdown_path, MarkdownSource.new(site: site, item: entry.item).content)
35
+ markdown_entries.filter_map do |entry|
36
+ content = markdown_content(entry)
37
+ next unless content
38
+
39
+ files.write(entry.url.markdown_path, content)
40
+ entry
32
41
  end
33
42
  end
34
43
 
35
- def write_html_links
36
- HtmlLinker.new(site: site, entries: entries).write
44
+ def markdown_content(entry)
45
+ MarkdownSource.new(site: site, item: entry.item).content
46
+ rescue Liquid::Error, SystemCallError => error
47
+ Jekyll.logger.warn("LLMs:", "Skipping markdown sidecar for #{entry.item.relative_path}: #{error}")
48
+ nil
49
+ end
50
+
51
+ def write_html_links(markdown_entries)
52
+ HtmlLinker.new(site: site, entries: markdown_entries).write
53
+ end
54
+
55
+ def markdown_entries
56
+ entries.select(&:markdown_source?)
37
57
  end
38
58
  end
39
59
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jekyll
4
4
  module Llms
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-llms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislav Katkov
@@ -106,6 +106,7 @@ executables: []
106
106
  extensions: []
107
107
  extra_rdoc_files: []
108
108
  files:
109
+ - CHANGELOG.md
109
110
  - LICENSE.txt
110
111
  - README.md
111
112
  - lib/jekyll-llms.rb