mirror of
https://github.com/halo-dev/theme-earth.git
synced 2025-10-15 07:15:47 +00:00
Add supports for docsme plugin (#250)
* docsme Signed-off-by: Ryan Wang <i@ryanc.cc> * Update Signed-off-by: Ryan Wang <i@ryanc.cc> * Add setting options Signed-off-by: Ryan Wang <i@ryanc.cc> --------- Signed-off-by: Ryan Wang <i@ryanc.cc>
This commit is contained in:
@@ -500,3 +500,20 @@ spec:
|
|||||||
name: gongan_link
|
name: gongan_link
|
||||||
label: 公安联网备案跳转链接
|
label: 公安联网备案跳转链接
|
||||||
value: https://beian.mps.gov.cn/#/query/webSearch
|
value: https://beian.mps.gov.cn/#/query/webSearch
|
||||||
|
- group: plugin
|
||||||
|
label: 插件集成
|
||||||
|
formSchema:
|
||||||
|
- $formkit: group
|
||||||
|
name: docsme
|
||||||
|
label: Docsme 文档管理
|
||||||
|
value:
|
||||||
|
source: theme
|
||||||
|
children:
|
||||||
|
- $formkit: select
|
||||||
|
name: source
|
||||||
|
label: 模板来源
|
||||||
|
options:
|
||||||
|
- label: 由此主题提供
|
||||||
|
value: theme
|
||||||
|
- label: 使用插件默认模板
|
||||||
|
value: plugin
|
||||||
|
@@ -111,3 +111,26 @@ select {
|
|||||||
padding-right: 1.85em;
|
padding-right: 1.85em;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Custom styles for docsme plugin
|
||||||
|
.dm-layout,
|
||||||
|
.dm-header__content {
|
||||||
|
@apply mx-auto max-w-7xl !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dm-header__content {
|
||||||
|
@apply px-4 lg:px-6 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dm-main-content {
|
||||||
|
@apply mx-auto max-w-7xl !important;
|
||||||
|
@apply px-4 lg:px-6 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dm-sidebar__content {
|
||||||
|
padding: 0 1rem !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dm-header {
|
||||||
|
z-index: 9 !important;
|
||||||
|
}
|
||||||
|
23
templates/doc-catalog.html
Normal file
23
templates/doc-catalog.html
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<th:block th:if="${theme.config.plugin.docsme.source == 'plugin'}">
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:doc-catalog}" />
|
||||||
|
</th:block>
|
||||||
|
|
||||||
|
<th:block th:if="${theme.config.plugin.docsme.source == 'theme'}">
|
||||||
|
<!doctype html>
|
||||||
|
<html
|
||||||
|
xmlns:th="https://www.thymeleaf.org"
|
||||||
|
th:replace="~{modules/doc-layout :: html(title = ${site.title}, hero = null, content = ~{::content}, head = ~{::head}, footer = null, sidebar = null, contentClass = null)}"
|
||||||
|
>
|
||||||
|
<th:block th:fragment="head">
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:modules/style}" />
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:modules/script}" />
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:modules/plugin-scripts}" />
|
||||||
|
</th:block>
|
||||||
|
<th:block th:fragment="content">
|
||||||
|
<div class="dm-container">
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:modules/header :: header (showThemeSwitcher = false)}" />
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:modules/doc-catalog :: doc-catalog (footer = null)}" />
|
||||||
|
</div>
|
||||||
|
</th:block>
|
||||||
|
</html>
|
||||||
|
</th:block>
|
24
templates/doc.html
Normal file
24
templates/doc.html
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<th:block th:if="${theme.config.plugin.docsme.source == 'plugin'}">
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:doc}" />
|
||||||
|
</th:block>
|
||||||
|
|
||||||
|
<th:block th:if="${theme.config.plugin.docsme.source == 'theme'}">
|
||||||
|
<!doctype html>
|
||||||
|
<html
|
||||||
|
xmlns:th="https://www.thymeleaf.org"
|
||||||
|
th:replace="~{modules/doc-layout :: html(title = ${site.title}, hero = null, content = ~{::content}, head = ~{::head}, footer = null, sidebar = null, contentClass = null)}"
|
||||||
|
>
|
||||||
|
<th:block th:fragment="head">
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:modules/style}" />
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:modules/script}" />
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:modules/prism}" />
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:modules/plugin-scripts}" />
|
||||||
|
</th:block>
|
||||||
|
<th:block th:fragment="content">
|
||||||
|
<div class="dm-container">
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:modules/header :: header (showThemeSwitcher = false)}" />
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:modules/doc :: doc (footer = null)}" />
|
||||||
|
</div>
|
||||||
|
</th:block>
|
||||||
|
</html>
|
||||||
|
</th:block>
|
23
templates/docs.html
Normal file
23
templates/docs.html
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<th:block th:if="${theme.config.plugin.docsme.source == 'plugin'}">
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:docs}" />
|
||||||
|
</th:block>
|
||||||
|
|
||||||
|
<th:block th:if="${theme.config.plugin.docsme.source == 'theme'}">
|
||||||
|
<!doctype html>
|
||||||
|
<html
|
||||||
|
xmlns:th="https://www.thymeleaf.org"
|
||||||
|
th:replace="~{modules/doc-layout :: html(title = ${site.title}, hero = null, content = ~{::content}, head = ~{::head}, footer = null, sidebar = null, contentClass = null)}"
|
||||||
|
>
|
||||||
|
<th:block th:fragment="head">
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:modules/style}" />
|
||||||
|
<th:block th:replace="~{plugin:plugin-docsme:modules/script}" />
|
||||||
|
</th:block>
|
||||||
|
<th:block th:fragment="content">
|
||||||
|
<div class="dm-container">
|
||||||
|
<th:block
|
||||||
|
th:replace="~{plugin:plugin-docsme:modules/docs :: docs (footer = null, showHeader = false, showThemeSwitcher = false)}"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</th:block>
|
||||||
|
</html>
|
||||||
|
</th:block>
|
26
templates/modules/base-head.html
Normal file
26
templates/modules/base-head.html
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<th:block th:fragment="base-head(title)">
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2" />
|
||||||
|
<title th:text="${title}"></title>
|
||||||
|
<link th:unless="${#strings.isEmpty(site.logo)}" rel="preload" th:href="${site.logo}" as="image" />
|
||||||
|
<link rel="stylesheet" th:href="@{/assets/dist/style.css?v={version}(version=${theme.spec.version})}" />
|
||||||
|
<script th:inline="javascript">
|
||||||
|
window.i18nResources = {
|
||||||
|
"jsModule.colorSchemeSwitcher.dark": `[(#{jsModule.colorSchemeSwitcher.dark})]`,
|
||||||
|
"jsModule.colorSchemeSwitcher.light": `[(#{jsModule.colorSchemeSwitcher.light})]`,
|
||||||
|
"jsModule.colorSchemeSwitcher.auto": `[(#{jsModule.colorSchemeSwitcher.auto})]`,
|
||||||
|
"jsModule.share.qzone": `[(#{jsModule.share.qzone})]`,
|
||||||
|
"jsModule.share.weibo": `[(#{jsModule.share.weibo})]`,
|
||||||
|
"jsModule.share.douban": `[(#{jsModule.share.douban})]`,
|
||||||
|
"jsModule.share.wechat": `[(#{jsModule.share.wechat})]`,
|
||||||
|
"jsModule.share.native": `[(#{jsModule.share.native})]`,
|
||||||
|
"jsModule.share.windowTitle": `[(#{jsModule.share.windowTitle})]`,
|
||||||
|
"jsModule.upvote.networkError": `[(#{jsModule.upvote.networkError})]`,
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<script th:src="@{/assets/dist/main.iife.js?v={version}(version=${theme.spec.version})}"></script>
|
||||||
|
<script>
|
||||||
|
main.initColorScheme("[[${theme.config.style.color_scheme}]]",[[${theme.config.style.enable_change_color_scheme}]])
|
||||||
|
</script>
|
||||||
|
</th:block>
|
48
templates/modules/doc-layout.html
Normal file
48
templates/modules/doc-layout.html
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html th:lang="${#locale.toLanguageTag}" th:fragment="html (title,hero,content,head,footer,sidebar,contentClass)">
|
||||||
|
<head>
|
||||||
|
<th:block th:replace="~{modules/base-head :: base-head(title = ${title})}" />
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var docsme = {
|
||||||
|
disableThemeFunction: true,
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<th:block th:if="${head != null}">
|
||||||
|
<th:block th:replace="${head}" />
|
||||||
|
</th:block>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
footer {
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#header-menu {
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
#btn-search {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<th:block th:replace="~{modules/header}" />
|
||||||
|
<section class="w-full" th:classappend="${contentClass}">
|
||||||
|
<th:block th:replace="${content}" />
|
||||||
|
</section>
|
||||||
|
<th:block th:replace="~{modules/footer}" />
|
||||||
|
|
||||||
|
<button
|
||||||
|
th:if="${theme.config.global.show_scroll_button}"
|
||||||
|
type="button"
|
||||||
|
id="btn-scroll-to-top"
|
||||||
|
th:aria-label="#{fragment.layout.toTop}"
|
||||||
|
class="fixed bottom-5 right-5 flex items-center justify-center rounded-full bg-white p-3 opacity-0 shadow transition-all duration-300 hover:opacity-70 hover:shadow-lg dark:bg-slate-600 lg:bottom-10 lg:right-10"
|
||||||
|
>
|
||||||
|
<span class="i-tabler-chevron-up text-2xl text-gray-600 dark:text-slate-200"></span>
|
||||||
|
</button>
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -1,33 +1,11 @@
|
|||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html th:lang="${#locale.toLanguageTag}" th:fragment="html (title,hero,content,head,footer,sidebar,contentClass)">
|
<html th:lang="${#locale.toLanguageTag}" th:fragment="html (title,hero,content,head,footer,sidebar,contentClass)">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<th:block th:replace="~{modules/base-head :: base-head(title = ${title})}" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2" />
|
|
||||||
<title th:text="${title}"></title>
|
|
||||||
<link th:unless="${#strings.isEmpty(site.logo)}" rel="preload" th:href="${site.logo}" as="image" />
|
|
||||||
<link rel="stylesheet" th:href="@{/assets/dist/style.css?v={version}(version=${theme.spec.version})}" />
|
|
||||||
<script th:inline="javascript">
|
|
||||||
window.i18nResources = {
|
|
||||||
"jsModule.colorSchemeSwitcher.dark": `[(#{jsModule.colorSchemeSwitcher.dark})]`,
|
|
||||||
"jsModule.colorSchemeSwitcher.light": `[(#{jsModule.colorSchemeSwitcher.light})]`,
|
|
||||||
"jsModule.colorSchemeSwitcher.auto": `[(#{jsModule.colorSchemeSwitcher.auto})]`,
|
|
||||||
"jsModule.share.qzone": `[(#{jsModule.share.qzone})]`,
|
|
||||||
"jsModule.share.weibo": `[(#{jsModule.share.weibo})]`,
|
|
||||||
"jsModule.share.douban": `[(#{jsModule.share.douban})]`,
|
|
||||||
"jsModule.share.wechat": `[(#{jsModule.share.wechat})]`,
|
|
||||||
"jsModule.share.native": `[(#{jsModule.share.native})]`,
|
|
||||||
"jsModule.share.windowTitle": `[(#{jsModule.share.windowTitle})]`,
|
|
||||||
"jsModule.upvote.networkError": `[(#{jsModule.upvote.networkError})]`,
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
<script th:src="@{/assets/dist/main.iife.js?v={version}(version=${theme.spec.version})}"></script>
|
|
||||||
<th:block th:if="${head != null}">
|
<th:block th:if="${head != null}">
|
||||||
<th:block th:replace="${head}" />
|
<th:block th:replace="${head}" />
|
||||||
</th:block>
|
</th:block>
|
||||||
<script>
|
|
||||||
main.initColorScheme("[[${theme.config.style.color_scheme}]]",[[${theme.config.style.enable_change_color_scheme}]])
|
|
||||||
</script>
|
|
||||||
</head>
|
</head>
|
||||||
<body class="bg-slate-50 dark:bg-slate-900">
|
<body class="bg-slate-50 dark:bg-slate-900">
|
||||||
<th:block th:replace="~{modules/header}" />
|
<th:block th:replace="~{modules/header}" />
|
||||||
|
Reference in New Issue
Block a user