webvpf / wn-simpledocs-plugin
简单文档 - Winter CMS 插件。
v1.0.8
2023-08-22 08:39 UTC
Requires
- composer/installers: ~1.0
README
WinterCMS 网站简单文档
截图: #2
安装 Composer
composer require webvpf/wn-simpledocs-plugin
文档创建
要在网站上显示文档,创建三个文件(布局模板和两个 CMS 页面)。
文档布局模板
在 themes/nameTheme/layouts
文件夹中创建一个新的文档模板布局。为此,创建一个包含以下内容的 docs.htm
文件。
description = "Template for documentation" [DocsMenu] docPage = "docs/item" == <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>{{ this.page.title }}</title> <link rel="icon" type="image/png" sizes="32x32" href="/plugins/webvpf/simpledocs/assets/img/icons/favicon.ico"> <link rel="stylesheet" href="/plugins/webvpf/simpledocs/assets/css/modern-normalize.min.css"> <link rel="stylesheet" href="/plugins/webvpf/simpledocs/assets/css/simpledocs.css"> {% styles %} {% if item.css %} <style>{{ item.css|raw }}</style> {% endif %} </head> <body> <aside class="docs-menubar"> <div class="docs-logo"> <a href="/docs"> <img src="/plugins/webvpf/simpledocs/assets/img/logo.png" height="32" alt="Documentation"> <span>Documentation</span> </a> </div> {% component 'DocsMenu' %} </aside> <main class="doc-content"> {% page %} </main> {% scripts %} {% if item.js %} <script>{{ item.js|raw }}</script> {% endif %} </body> </html>
文档页面
现在我们需要创建两个 CMS 页面。其中一个将显示 主要文档页面,另一个显示文档记录。
这两个页面都将被隐藏。隐藏页面仅供登录用户(在后台授权)访问。要使您的文档对互联网上的每个人可用,只需从页面设置中删除 is_hidden = 1
参数。
文档主页
在 themes/nameTheme/pages/docs
文件夹中创建一个 docs.htm
文件。
title = "Documentation" url = "/docs" layout = "docs" is_hidden = 1 == <p>This is the main documentation page.</p>
文档记录输出页面
在 themes/nameTheme/pages/docs
文件夹中创建一个 item.htm
文件。
title = "Documentation record page" url = "/docs/:slug" layout = "docs" is_hidden = 1 [DocsItem] slug = "{{ :slug }}" stek = "wn" theme = "default" == {% component 'DocsItem' %}
快速启动样式连接到布局
代码高亮显示
使用 Markdown 语法将示例代码插入到文档的文本中。
在代码的开始和结束之前,插入字符行 ```
。
将代码所属的编程语言或技术的标识符添加到前三个引号中。例如,对于 HTML,标识符是 html
,对于 CSS - css
,对于 JavaScript - javascript
或简写 js
。
插入 PHP 代码的示例
```php
public function nameFunction()
{
return 'Text';
}
```