Skip to content

feat: add pages written in Desk (Compendium Page) (backport #28) - #31

Merged
barredterra merged 2 commits into
version-16-hotfixfrom
mergify/bp/version-16-hotfix/pr-28
Sep 29, 2026
Merged

barredterra merged 2 commits into
version-16-hotfixfrom
mergify/bp/version-16-hotfix/pr-28

Conversation

@mergify

@mergify mergify Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Lets users write documentation pages in Desk, stored in the site's database, on top of the docs that apps ship — e.g. a site wiki, or a correction of an app page that doesn't fit the site.

What changes

  • New DocType Compendium Page: title, language, path, sort order, roles, published flag, Markdown content. The path is filled from the title when empty (Getting Started → getting-started), is validated like file paths, and must be unique per language.
  • Composition (docs.py): published pages join discovery as the last layer, after all installed apps. A page at an app page's path replaces it; translations follow the existing canonical-language rules, so a translated page takes sort order and roles from the canonical page. Unpublished pages don't exist for readers and don't hide app pages.
  • Attachments: /private/files/… URLs in images and links are served through get_asset, only if the file is attached to that page and the reader may read it. Any other private file is refused, so authors can't expose files from elsewhere. Public /files/… URLs are left as they are.
  • Docs browser:
    • + Add new Page (users who may create a Compendium Page) at the bottom of the sidebar, and a + on each sidebar row (shown on hover) to add a page below it. The new form presets the current locale and the parent path (guides/ → guides/<slug> from the title).
    • Edit button in the page footer, next to "Copy as Markdown". For a page written in Desk it opens the form. For an app page it opens a dialog: Override with Compendium Page (create permission) or Edit on GitHub (Compendium Contributor role, and only when the app declares a repository and docs_branch). Without create permission, Edit goes straight to GitHub. The button only shows when one of these actions is available. The old footer text links are gone.
    • Override works like get_mapped_doc: make_override returns an unsaved Compendium Page with the app page's title, path, language, sort order, content and roles; the client syncs it and opens the form. Nothing is stored until the user saves.
  • Groups without an index page: clicking such a group now opens a generated overview that lists its child pages (only those the reader may see). Edit on the overview starts the group's index page (path and title preset). Breadcrumbs for these groups are now links.
  • Form: View button; a path ending in / (preset by the sidebar) gets the slug appended when the title is typed.
  • Search: the index fingerprint includes the pages' count and latest modified, so saves and deletes show up without a restart.
  • Permissions: System Manager and Compendium Contributor can create and edit pages. The browser checks DocType permissions (frappe.model.can_create, server-side has_permission for the edit route), so custom permissions carry over. Edit on GitHub stays tied to the Compendium Contributor role.

Notes

  • content has ignore_xss_filter: Frappe's save-time sanitizing escaped Markdown's > and broke blockquotes and alerts. Rendering still runs sanitize_html, so readers only ever get sanitized HTML (covered by a test).
  • The field is labelled Sort Order because Frappe translates "Order" into German as "Auftrag".
  • Images with relative paths in an app page don't carry over to an override; the docs tell authors to attach them.

Docs & tests

  • New user page "Writing Pages in Desk" (en + de), covering adding pages, groups and index pages, and overriding app pages; authoring guide, index and search pages updated; German translations for the new UI strings.
  • Tests for composition and override, make_override, the group overview (incl. hidden groups), the translation roles rule, path handling, attachment serving, the edit route and search freshness. Existing file-based tests no longer depend on pages stored on the site.
  • Cypress: Edit dialog with Edit on GitHub, + Add new Page and the group +.

Tested

  • A Compendium Page renders in Compendium, including all supported .md features
  • A Compendium Page can overwrite an App-generated Page.
  • Attachments work as described
  • Sidebar + Add new Page and + open a prefilled form
  • Edit → Override with Compendium Page opens a prefilled, unsaved form
  • A group without an index page shows the overview, and Edit starts its index page

This is an automatic backport of pull request #28 done by [Mergify](https://mergify.com).

@mergify mergify Bot added the conflicts label Sep 29, 2026
@mergify

This comment was marked as resolved.

@mergify mergify Bot mentioned this pull request Sep 29, 2026
6 tasks done
@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[Medium risk] Adds a new document type for user-authored documentation pages.

The PR does not yet appear safe to merge because create-only users are still offered an edit action they cannot complete.

Reviews (3) · Last reviewed commit: "fix: SQL functions"

Comment thread compendium/compendium/page/docs/docs.js Outdated
Comment thread compendium/search.py Outdated
Comment thread compendium/compendium/page/docs/docs.js
Comment thread compendium/compendium/page/docs/docs.js
Co-authored-by: barredterra <14891507+barredterra@users.noreply.github.com>
@barredterra
barredterra force-pushed the mergify/bp/version-16-hotfix/pr-28 branch from b57caf9 to 74e9592 Compare September 29, 2026 22:19
@barredterra
barredterra merged commit cc6ca7f into version-16-hotfix Sep 29, 2026
5 checks passed
@barredterra
barredterra deleted the mergify/bp/version-16-hotfix/pr-28 branch September 29, 2026 22:43
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