Filament Knowledge Base
repository·main·Indexed 42 days ago
https://github.com/guavacz/filament-knowledge-baseA markdown-powered documentation plugin for Filament that provides a navigable documentation panel and integrates help features—such as modals, menus, and sidebar links—into existing Filament panels. It supports global search, multi-locale documentation, and contextual help via the HelpAction and HasKnowledgeBase contract. Compatible with Filament v3 (plugin v1.x), v4 (plugin v2.x), and v5 (plugin v3.x).
What's inside Filament Knowledge Base
- The Filament Knowledge Base is a markdown-powered documentation system designed specifically for Filament v3 panels. It allows you to write documentation using standard markdown files and serves them to your users as a searchable, styled knowledge base integrated directly within your Filament interface.
Overview of Filament Knowledge Base
mainFilament Knowledge Base is a plugin designed to manage and display product documentation directly within your Filament panels. It allows you to write documentation in Markdown files and automatically registers a dedicated panel where users can browse these files.
Key features include:
- Knowledge base panel: A dedicated panel for hosting all documentation.
- Modal previews: Ability to render Markdown content in customizable modals with an option to navigate to the full documentation page.
- Global search: Built-in search functionality that indexes the
titleandcontentof your Markdown files.
Supported features for Tables and lists
mainThe Tables and lists feature in the knowledge base supports the following capabilities:
- Markdown rendering: Full support for rendering markdown content.
- Syntax highlighting: Automatic syntax highlighting for code blocks within lists or tables.
- Modal previews: Ability to preview content within modals.
Define groups and parent items in navigation
mainThe relationship between navigation items is determined by the presence of a sibling markdown file named after a directory.
Parent Items
If a directory (e.g.,
roles/) has a sibling markdown file of the same name (roles.md) that is a regular documentation file, that file becomes a parent item, and the files inside the directory become its children.Groups
If a directory has a sibling markdown file of the same name that is configured as a
groupvia front matter, it becomes a group in the navigation. A group file contains only front matter.Example Group Configuration (
roles.md):--- type: group title: Advanced icon: heroicon-o-academic-cap ---Use the KnowledgeBasePlugin to create a knowledge base panel
mainThe
KnowledgeBasePluginallows you to transform a Filament panel into a dedicated knowledge base. When enabled, the panel automatically renders your markdown files and provides built-in UI components including:- Sidebar navigation
- Breadcrumbs
- Table of contents
How the knowledge base panel is rendered
mainThe knowledge base panel is a documentation interface rendered directly from Markdown files located in theworkbench/docs/knowledge-basedirectory. It is designed to allow developers to verify package changes within a live Filament panel environment by runningcomposer start.Structure and organization of Markdown files
mainMarkdown files are the primary way to populate your knowledge base. They consist of a YAML front matter block for metadata and content for the actual text.
Directory Structure
By default, files are stored in the
docsdirectory. The structure must follow this pattern to support localization and panel separation:docs/{panel-id}/{locale}/{files-or-subdirectories}Example:
docs/my-knowledge-base/en/01-getting-started.md(English documentation)docs/my-knowledge-base/es/users/01-introduction.md(Spanish documentation in a subfolder)
You can nest files up to three levels deep. The knowledge base navigation will mirror this directory tree structure.
docs/ <your-panel-id>/ en/ 01-getting-started.md users/ 01-introduction.mdHow Knowledge Base works with Filament panels
mainKnowledge Base transforms a Filament panel into a documentation site using Markdown files. It provides a navigable interface including a sidebar, breadcrumbs, a table of contents, and global search.
The system relies on two complementary plugins:
KnowledgeBasePlugin: Registered on a dedicated panel to serve as the actual knowledge base site.KnowledgeBaseCompanionPlugin: Registered on your existing application panels to integrate the knowledge base. It adds a help menu to the topbar, documentation previews in modals, and a link to the knowledge base in the sidebar.
How the knowledge base structure and content work
mainThe knowledge base is composed of plain Markdown files. The directory structure of these files determines the navigation hierarchy within your Filament panels. Each individual page is configured using YAML front matter at the top of the Markdown file.How help menu navigation works
mainThe behavior of clicking a help menu item depends on your configuration:
- Default: The user is redirected to the full documentation page within the knowledge base panel.
- With Modal Previews: If modal previews are enabled, the documentation opens in a modal overlay, allowing the user to view the content without leaving their current page.
Code highlighting in knowledge base articles
mainFenced code blocks within your knowledge base articles are automatically highlighted using Phiki. This allows you to include syntax-highlighted snippets for various programming languages (e.g., PHP, Bash) directly in your documentation content.
use Guava\ FilamentKnowledgeBase\\Plugins\\KnowledgeBasePlugin; $panel->plugins([ KnowledgeBasePlugin::make(), ]);Configure page metadata using Front Matter
mainEach documentation page's metadata is controlled via YAML front matter at the top of the Markdown file. You can define the following keys:
title: The display title of the page.icon: The Heroicon name used for the page (e.g.,heroicon-o-rocket-launch).order: The numerical position of the page in the navigation sequence.
--- title: Getting started icon: heroicon-o-rocket-launch order: 1 ---