Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,25 @@ jobs:
exit 1
fi

python-tests:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Running tests for the LLM Markdown converter

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.13"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt

- name: Run pytest
run: pytest

markdownlint:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/vendor/
**/.DS_Store
__pycache__/*
hooks/__pycache__/*
**/__pycache__
/site/
**/.idea/
.php-cs-fixer.cache
Expand Down
72 changes: 71 additions & 1 deletion docs/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ body {
}

.md-typeset h1 {
margin: 0 0 1rem;
margin: 0 0 0.5rem;
font-size: 24px;
line-height: 34px;
}
Expand Down Expand Up @@ -649,3 +649,73 @@ div.path {
[hidden] {
display: none !important;
}

.page-actions {
display: none;
gap: 0;
margin: 12px 0 2rem 0;
padding-bottom: 6px;
border-bottom: 1px solid var(--ibexa-snow);
}

.md-typeset .page-action-btn {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 4px 12px;
background: transparent;
border: none;
text-decoration: none;
color: var(--ibexa-dusk-black);
font-size: 13px;
font-weight: 500;
cursor: pointer;
transition: color 0.15s ease;
white-space: nowrap;
position: relative;
}

.page-action-btn+.page-action-btn::before {
content: '';
position: absolute;
left: 0;
top: 50%;
transform: translateY(-50%);
height: 16px;
width: 1px;
background: var(--ibexa-snow);
}

.page-action-btn svg {
width: 14px;
height: 14px;
fill: currentColor;
flex-shrink: 0;
}

.page-action-btn.external::after,
.page-action-btn[rel="nofollow"]::after {
display: none;
}

@media (max-width: 768px) {
.page-actions {
gap: 0;
}
}

.page-actions--visible {
display: flex;
}

.page-action-btn.page-action-btn--success {
background: #d4edda;
border-color: #c3e6cb;
color: #155724;
}

.page-action-btn.page-action-btn--info {
background: color-mix(in srgb, var(--turquoise-pearl) 25%, white);
border-color: color-mix(in srgb, var(--turquoise-pearl) 40%, white);
color: var(--sherpa-blue);
}
2 changes: 1 addition & 1 deletion docs/css/navigation.css
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@
margin-left: 0;
margin-top: 0;
margin-bottom: 0;
padding-bottom: 2rem;
padding-bottom: 0.5rem;
}

ul.breadcrumbs li.breadcrumb-item {
Expand Down
4 changes: 1 addition & 3 deletions docs/css/release-notes.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<a href="release_notes/ibexa_dxp_v5.0/">Release notes</a>
</div>
<div class="notification__image">
<img src="images/notification-latest-release.svg" alt="The latest release" />
<img src="images/notification-latest-release.svg" alt="" />

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Icons don't need alt text

</div>
</div>
</div>
Expand All @@ -97,7 +97,7 @@
<a href="ibexa_products/editions/#lts-updates">Discover other LTS Updates</a>
</div>
<div class="notification__image">
<img src="images/notification-lts-update.svg" alt="LTS Update" />
<img src="images/notification-lts-update.svg" alt="" />
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions docs/personalization/api_reference/api_reference.md

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For all files in perso: exclude them from the Markdown-generated content (llms.txt, llms-full.txt, page actions)

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: Explore Personalization API sets that let you manage item data, track events, combine tracking data with users and render recommendations.
page_type: landing_page
exclude_from_llmstxt: true
---

# Personalization API
Expand Down
1 change: 1 addition & 0 deletions docs/personalization/api_reference/content_api.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: Personalization server can use external information about the items. Use HTTP methods to create, update or get items from the data store.
exclude_from_llmstxt: true
---

# Content API
Expand Down
1 change: 1 addition & 0 deletions docs/personalization/api_reference/recommendation_api.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: Use HTTP GET request method to render recommendations.
month_change: false
exclude_from_llmstxt: true
---

# Recommendation API
Expand Down
1 change: 1 addition & 0 deletions docs/personalization/api_reference/tracking_api.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: Allows to track items based on an ID. It covers many content types with the same ID configured for tracking.
exclude_from_llmstxt: true
---

# Tracking API
Expand Down
1 change: 1 addition & 0 deletions docs/personalization/api_reference/user_api.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: Use HTTP methods to correlate metadata with user data and combine users into clusters of certain type.
exclude_from_llmstxt: true
---

# User API
Expand Down
1 change: 1 addition & 0 deletions docs/personalization/attribute_search_in_elasticsearch.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: Attribute search uses Elasticsearch database to display dynamically taken values in scenario and model previews.
exclude_from_llmstxt: true
---

# Attribute search in Elasticsearch database
Expand Down
1 change: 1 addition & 0 deletions docs/personalization/enable_personalization.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: Configure your project files to enable Personalization and set up items you want to track.
month_change: false
exclude_from_llmstxt: true
---

# Enable Personalization
Expand Down
1 change: 1 addition & 0 deletions docs/personalization/how_it_works.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: Integrate recommendation service into your website.
exclude_from_llmstxt: true
---

# How Personalization works
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: Use historical user tracking data to build user profiles and generate better recommendations.
exclude_from_llmstxt: true
---

# Importing historical user tracking data
Expand Down
1 change: 1 addition & 0 deletions docs/personalization/integrate_recommendation_service.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: Integrate recommendation service into your website.
month_change: false
exclude_from_llmstxt: true
---

# Integrate recommendation service
Expand Down
1 change: 1 addition & 0 deletions docs/personalization/legacy_recommendation_api.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: An old method of fetching recommendations from the system using recommendation requests.
exclude_from_llmstxt: true
---

# Legacy Recommendation API
Expand Down
1 change: 1 addition & 0 deletions docs/personalization/personalization.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: Personalization tracks consumed content and suggests targeted content to your website visitors.
page_type: landing_page
exclude_from_llmstxt: true
---

# Personalization
Expand Down
1 change: 1 addition & 0 deletions docs/personalization/personalization_guide.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: Discover Personalization - a cloud-based service that tracks and analyzes customer behaviors.
exclude_from_llmstxt: true
---

# Personalization product guide
Expand Down
1 change: 1 addition & 0 deletions docs/personalization/recommendation_integration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
description: Methods for REST call with Personalization server.
exclude_from_llmstxt: true
---

# Recommendation integration
Expand Down
1 change: 1 addition & 0 deletions docs/personalization/tracking_integration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: See the methods of event tracking integration using tracking from server or from client-side.
month_change: false
exclude_from_llmstxt: true
---

# Tracking integration
Expand Down
1 change: 1 addition & 0 deletions docs/personalization/tracking_with_ibexa-tracker.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
description: Integrate tracking with a Google-style JavaScript.
month_change: false
exclude_from_llmstxt: true
---

# Track events with ibexa-tracker.js
Expand Down
2 changes: 1 addition & 1 deletion docs/templating/embed_and_list_content/list_content.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Then, in the content view configuration, add the configuration under `content_qu

The `match` configuration matches both the content type and the identifier of the Content query field.

Finally, in the template `templates/themes/<my_theme/content_query/blog_posts.html.twig`, render all results of the query:
Finally, in the template `templates/themes/<my_theme>/content_query/blog_posts.html.twig`, render all results of the query:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The lack of closing > broke the Markdown rendering (discovered when checking the output manually)


``` html+twig
[[= include_file('code_samples/front/list_content/templates/themes/my_theme/full/blog_post.html.twig') =]]
Expand Down
96 changes: 96 additions & 0 deletions hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
"""
MkDocs hooks for Ibexa developer documentation.

- Keeps the llmstxt plugin's ``sections`` config in sync with the ``nav``
defined in ``mkdocs.yml``.
- Post-processes the Markdown generated by the llmstxt plugin.

All content transformations live in ``llmstxt_preprocess.py``; this module is
only MkDocs event glue.
"""

from __future__ import annotations

import sys
from pathlib import Path, PurePosixPath
from typing import TYPE_CHECKING

_here = Path(__file__).parent
if str(_here) not in sys.path:
sys.path.insert(0, str(_here))

from llmstxt_preprocess import (
absolutize_image_urls,
editions_from_frontmatter,
expand_macros,
inject_page_metadata,
renumber_ordered_lists,
)
from update_llmstxt_config import convert_nav_to_llmstxt_sections

if TYPE_CHECKING:
from mkdocs.config.defaults import MkDocsConfig
from mkdocs.structure.pages import Page


def on_config(config: "MkDocsConfig") -> None:
"""Populate llmstxt sections from nav before the build starts.

The llmstxt plugin reads ``config.sections`` in its ``on_files`` event,
which fires after ``on_config``, so injecting here is the right place.
"""
nav = config.get("nav")
if not nav:
return

llmstxt = config["plugins"].get("llmstxt")
if llmstxt is None:
return

docs_dir = Path(config["docs_dir"])
llmstxt.config.sections = convert_nav_to_llmstxt_sections(nav, docs_dir)


def on_page_content(html: str, *, page: "Page", config: "MkDocsConfig", **kwargs) -> None:
"""Reformat the Markdown content generated by the llmstxt plugin for this page.

Hooks run after plugins for every event, so at this point the llmstxt
plugin has already generated Markdown and stored it in ``_md_pages``.
We reformat here so the plugin writes the corrected content in its own
``on_post_build`` (which also runs before ours, for the same reason).
"""
llmstxt = config["plugins"].get("llmstxt")
if llmstxt is None:
return

src_uri = page.file.src_uri
page_info = llmstxt._md_pages.get(src_uri)
if page_info is None:
return

frontmatter = _read_frontmatter(page, config)
editions = editions_from_frontmatter(frontmatter)
description = expand_macros(str(frontmatter.get("description") or ""), config.get("extra") or {})
if "[[=" in description:
# Unresolved macros must not leak into the output.
description = ""
content = inject_page_metadata(page_info.content, description, editions)
content = renumber_ordered_lists(content)
# Same base URL and page directory the plugin uses for making link hrefs absolute.
page_dir = PurePosixPath(page.file.dest_uri).parent.as_posix()
content = absolutize_image_urls(content, llmstxt._base_url, page_dir)
if content != page_info.content:
llmstxt._md_pages[src_uri] = page_info._replace(content=content)


def _read_frontmatter(page: "Page", config: "MkDocsConfig") -> dict:
"""Read the page's YAML frontmatter from its source file."""
src_path = Path(config["docs_dir"]) / page.file.src_path
try:
from mkdocs.utils import meta as mkdocs_meta
with open(src_path, encoding="utf-8") as f:
raw = f.read()
_, frontmatter = mkdocs_meta.get_data(raw)
return frontmatter
except Exception:
return {}
Loading
Loading