diff --git a/exampleSite/content/_index.zh.md b/exampleSite/content/_index.zh.md new file mode 100644 index 00000000000..6e20c858196 --- /dev/null +++ b/exampleSite/content/_index.zh.md @@ -0,0 +1,45 @@ +--- +title: "Learn Theme for Hugo" +--- + +# Hugo Learn Theme + +[Hugo-Theme-Learn](http://github.com/matcornic/hugo-theme-learn)是一个 [Hugo](https://gohugo.io/)主题。Hugo是一种用Go语言编写的快速、现代静态网站引擎。Hugo经常用于博客,这个多语言主题**完全是为文档设计的**。 + +这个主题是网站[Grav](https://getgrav.org/)的[Learn theme](http://learn.getgrav.org/)主题的部分移植。Grav网站是一个用PHP编写的现代flat-file内容管理系统(CMS)。 + +{{% notice tip %}} +Learn Theme使用 _树状网页结构_ 来组织内容:所有的内容都以网页的形式存在,而每个网页都从属于其他网页。 [了解更多]({{%relref "cont/pages/_index.md"%}}) +{{% /notice %}} + +## 主要特征 + +* [自动搜索]({{%relref "basics/configuration/_index.md#activate-search" %}}) +* [多语言模式]({{%relref "cont/i18n/_index.md" %}}) +* **无限目录层次** +* **贯穿目录条目的自动前翻/后翻按钮** +* [图片缩放,阴影...]({{%relref "cont/markdown.zh.md#images" %}}) +* [附件]({{%relref "shortcodes/attachments.zh.md" %}}) +* [子网页列表]({{%relref "shortcodes/children/_index.md" %}}) +* [Mermaid图表]({{%relref "shortcodes/mermaid.zh.md" %}}) (flowchart, sequence, gantt) +* [定制外观和主题变量]({{%relref "basics/style-customization/_index.md"%}}) +* [Buttons按钮]({{%relref "shortcodes/button.zh.md" %}}), [提示/注意/信息/警告框]({{%relref "shortcodes/notice.zh.md" %}}), [展开]({{%relref "shortcodes/expand.zh.md" %}}) + +![Screenshot截图](https://raw.githubusercontent.com/matcornic/hugo-theme-learn/master/images/screenshot.png?width=40pc&classes=shadow) + + +## 为本文档做贡献 + +请自由升级此内容,只需点击每个页面右上方**编辑此页面**链接,执行pull request。 + +{{% notice info %}} +你的修改将在版本合并后生效。 +{{% /notice %}} + +## 文档网站 + +当前文档可以使用简单的Hugo命令静态生成:`hugo -t hugo-theme-learn` -- 源代码在 [GitHub中](https://github.com/matcornic/hugo-theme-learn) + +{{% notice note %}} +自动发布使用[Netlify](https://www.netlify.com/)。详情参阅 [Automated HUGO deployments with Netlify](https://www.netlify.com/blog/2015/07/30/hosting-hugo-on-netlifyinsanely-fast-deploys/) +{{% /notice %}} \ No newline at end of file diff --git a/exampleSite/content/basics/_index.zh.md b/exampleSite/content/basics/_index.zh.md index 6c5d5dacce5..845aa8683c0 100755 --- a/exampleSite/content/basics/_index.zh.md +++ b/exampleSite/content/basics/_index.zh.md @@ -5,8 +5,8 @@ pre: "1. " chapter: true --- -### 章节 1 +### 第一章 # 基础 -了解该 Hugo 主题的特点以及背后的核心概念。 +了解这个Hugo主题的功能以及背后的核心概念。 diff --git a/exampleSite/content/basics/configuration/_index.zh.md b/exampleSite/content/basics/configuration/_index.zh.md new file mode 100644 index 00000000000..81ae8b62507 --- /dev/null +++ b/exampleSite/content/basics/configuration/_index.zh.md @@ -0,0 +1,107 @@ +--- +date: 2016-04-09T16:50:16+02:00 +title: 配置 +weight: 20 +--- + +## 网站全局参数 + +根据[Hugo全局配置](https://gohugo.io/overview/configuration/), **Hugo-Theme-Learn** 允许在`config.toml`中定义下列参数(这里的值是默认值)。请注意,部分参数会在本文的的其他部分详细解释。 + +```toml +[params] + # Prefix URL to edit current page. Will display an "Edit this page" button on top right hand corner of every page. + # Useful to give opportunity to people to create merge request for your doc. + # See the config.toml file from this documentation site to have an example. + editURL = "" + # Author of the site, will be used in meta information + author = "" + # Description of the site, will be used in meta information + description = "" + # Shows a checkmark for visited pages on the menu + showVisitedLinks = false + # Disable search function. It will hide search bar + disableSearch = false + # Javascript and CSS cache are automatically busted when new version of site is generated. + # Set this to true to disable this behavior (some proxies don't handle well this optimization) + disableAssetsBusting = false + # Set this to true to disable copy-to-clipboard button for inline code. + disableInlineCopyToClipBoard = false + # A title for shortcuts in menu is set by default. Set this to true to disable it. + disableShortcutsTitle = false + # If set to false, a Home button will appear below the search bar on the menu. + # It is redirecting to the landing page of the current language if specified. (Default is "/") + disableLandingPageButton = true + # When using mulitlingual website, disable the switch language button. + disableLanguageSwitchingButton = false + # Hide breadcrumbs in the header and only show the current page title + disableBreadcrumb = true + # If set to true, prevents Hugo from including the mermaid module if not needed (will reduce load times and traffic) + disableMermaid = false + # Specifies the remote location of the mermaid js + customMermaidURL = "https://unpkg.com/mermaid@8.8.0/dist/mermaid.min.js" + # Hide Next and Previous page buttons normally displayed full height beside content + disableNextPrev = true + # Order sections in menu by "weight" or "title". Default to "weight" + ordersectionsby = "weight" + # Change default color scheme with a variant one. Can be "red", "blue", "green". + themeVariant = "" + # Provide a list of custom css files to load relative from the `static/` folder in the site root. + custom_css = ["css/foo.css", "css/bar.css"] + # Change the title separator. Default to "::". + titleSeparator = "-" +``` + +## 激活搜索 + +如果还没有搜索功能,在同样的`config.toml`文件中添加下面代码。 + +```toml +[outputs] +home = [ "HTML", "RSS", "JSON"] +``` + +Learn Theme使用Hugo版本20+的最新改进,生成了一个使用lunr.js javascript收索引擎的json索引文件。 + +> Hugo会在公用文件夹的根目录生成lunrjs index.json。 +> 当使用编译网站,Hugo会内部生成,不会出现在文件系统中。 + +## Mermaid + +Mermaid的配置参数可以在一个具体页面内设置。在这种情况下,本地设置会覆盖全局设置。 + +> 例如: +> +> Mermaid是全局关闭的。默认情况下,不会再任何页面加载。 +> 在"Architecture"页面上,你需要一个类图。你可以只在这个页面设置参数加载Mermaid(无需在其它页面配置)。 + +在全局使能时,你也可以在具体页面关闭Mermaid。 + +## 返回首页按钮 + +如果`disableLandingPage`配置为`false`, 左侧菜单栏里就会出现返回首页按钮。这可以替代单击Logo。你可以通过配置对应语言的两个参数编辑外观。 + +```toml +[Lanugages] +[Lanugages.en] +... +landingPageURL = "/en" +landingPageName = " Redirect to Home" +... +[Lanugages.fr] +... +landingPageURL = "/fr" +landingPageName = " Accueil" +... +``` + +如果特定语言的参数没有配置,就会使用默认值。 + +```toml +landingPageURL = "/" +landingPageName = " Home" +``` + +返回首页按钮就会变成下面这样: + +![Default Home Button](/en/basics/configuration/images/home_button_defaults.jpg?width=100%) diff --git a/exampleSite/content/basics/installation/_index.zh.md b/exampleSite/content/basics/installation/_index.zh.md new file mode 100644 index 00000000000..fbd095b5877 --- /dev/null +++ b/exampleSite/content/basics/installation/_index.zh.md @@ -0,0 +1,102 @@ +--- +title: 建立网站 +weight: 15 +--- + +下面的步骤可以帮助你初始化新网站。如果你对Hugo一无所知,强烈建议先学习 [great documentation for beginners](https://gohugo.io/overview/quickstart/)。 + +## 创建你的网站 + +在Hugo中使用`new`命令创建新网站。 + +``` +hugo new site +``` + +## 安装主题 + +根据[这个文档](https://gohugo.io/getting-started/quick-start/#step-3-add-a-theme)安装 **Hugo-theme-learn** 主题。 + +这个主题仓库地址为:https://github.com/matcornic/hugo-theme-learn.git + +你也可以[下载 .zip](https://github.com/matcornic/hugo-theme-learn/archive/master.zip) 文件,解压缩到 `themes` 文件夹中。 + +## 基本配置 + +在编译网站时,你可以用`--theme`设置主题。尽管,我们建议你修改配置文件(`config.toml`),设置默认主题。你也可以添加`[outputs]`部分使能搜索功能。 + +```toml +# Change the default theme to be use when building the site with Hugo +theme = "hugo-theme-learn" + +# For search functionality +[outputs] +home = [ "HTML", "RSS", "JSON"] +``` + +## 创建第一个章页面 + +章页面包含其他子页面。他按照特殊的样式排版,通常只包含 _章名称_, _标题_ 和 _摘要_ 等几部分。 + +``` +### Chapter 1 + +# Basics + +Discover what this Hugo theme is all about and the core concepts behind it. +``` + +效果如下: + +![A Chapter](/en/basics/installation/images/chapter.png?classes=shadow&width=60pc) + +**Hugo-theme-learn** 提供创建网站框架需要的模板。以下面命令创建的第一个章页面开始。 + +``` +hugo new --kind chapter basics/_index.md +``` + +打开创建的文件,你可以看到内容上方有`chapter=true`,表示本页面是一个 _章_。 + +所有章和内容页面在创建时默认是草稿。如果你想提交这些页面,在内容中去掉`draft: true`。 + +## 创建第一个内容页面 + +接着,在前一章里创建内容页面。这里有两个创建方法: + +``` +hugo new basics/first-content.md +hugo new basics/second-content/_index.md +``` + +请自由编辑这些文件,替换文件开头`title`的值,添加内容。 + +## 本地运行 + +使用下面命令运行: + +``` +hugo serve +``` + +打开 `http://localhost:1313` + +有三点需要注意: + +1. 你有一个靠左的**基本**菜单,包含和之前创建文件`title`相同的子菜单。 +2. 主页解释怎么参照下面说明定制化。 +3. 当运行`hugo serve`后,文件内容发生改变,页面会自动更新修改。小巧优雅! + +## 生成网站 + +当网站已经部署,运行下列命令: + +``` +hugo +``` + +会生成一个`public`文件夹,包含网站所有静态内容和有用数据。现在可以部署到任何网页服务器上。 + +{{% notice note %}} +网站可以使用 [Netlify](https://www.netlify.com/)自动发布。了解更多[Automated HUGO deployments with Netlify](https://www.netlify.com/blog/2015/07/30/hosting-hugo-on-netlifyinsanely-fast-deploys/)。或者使用[Github pages](https://gohugo.io/hosting-and-deployment/hosting-on-github/)。 +{{% /notice %}} diff --git a/exampleSite/content/basics/requirements/_index.zh.md b/exampleSite/content/basics/requirements/_index.zh.md new file mode 100644 index 00000000000..6dc18825140 --- /dev/null +++ b/exampleSite/content/basics/requirements/_index.zh.md @@ -0,0 +1,11 @@ +--- +title: 准备工作 +weight: 10 +disableToc: true +--- + +得益于Hugo的精简,准备工作显得空空荡荡。 + +只需要根据你的系统 (Windows, Linux, Mac)下载最新版的[Hugo binary (> 0.25)](https://gohugo.io/getting-started/installing/):就是这么简单! + +![Magic](/en/basics/requirements/images/magic.gif?classes=shadow) diff --git a/exampleSite/content/basics/style-customization/_index.zh.md b/exampleSite/content/basics/style-customization/_index.zh.md new file mode 100644 index 00000000000..ee73858cf53 --- /dev/null +++ b/exampleSite/content/basics/style-customization/_index.zh.md @@ -0,0 +1,196 @@ +--- +date: 2016-04-09T16:50:16+02:00 +title: 定制风格 +weight: 25 +--- + +为了尽量做到可配置,在 **Hugo-Theme-Learn** 开发中定义了多个[局部模板 partials](https://gohugo.io/templates/partials/)。 + +在`themes/hugo-theme-learn/layouts/partials/`里,你可以看到主题的所有局部模板。如果你想做些修改,不要直接修改这些代码。请按照[这里的说明](https://gohugo.io/themes/customizing/). 你可以在本地工程的`layouts/partials`文件夹中创建一个新的局部模板。这个模板有更高优先级. + +本主题定义了下面局部模板: + +- *header*: 内容页面的页眉(包含面包屑导航)。_不会覆盖_ +- *custom-header*: 自定义页面的页眉。在添加CCS导入时会覆盖。不要忘记在你的文件中包含HTML标签指令`style`。 +- *footer*:内容页面的页脚 _不会覆盖_ +- *custom-footer*: 页面的自定义页脚。在添加Javacript时会覆盖。不要忘记在你的文件中包含HTML标签指令`javascript`。 +- *favicon*: 网站图标。 +- *logo*: Logo,在左上角。 +- *meta*: HTML元标签,如果你需要改变默认行为。 +- *menu*: 左面菜单。 _不会覆盖_ +- *menu-footer*: 左面菜单的页脚 +- *search*: 搜索框 +- *toc*: 内容列表 + +## 修改Logo + +在`layouts/partials/`中创建一个名为`logo.html`的文件. 写成任何你想要的HTML. +你可以使用一个`img`HTML标签来引用*static*文件夹下的一个图片,或者贴一个SVG定义! + +{{% notice note %}} +The size of the logo will adapt automatically +{{% /notice %}} + +## 改变网站图标 + +如果图标是png格式,将图片放到`static/images/`文件夹,命名为`favicon.png`就可以了。 + +如果你需要改变默认的行为,在`layouts/partials/`中创建一个名为`favicon.html`的文件。然后,按下面格式添加内容: + +```html + +``` + +## 改变默认颜色 {#theme-variant} + +**Hugo Learn theme** 提供三种基础颜色方案变量可选,但你可以按照需要添加自己的颜色! 默认颜色方案基于[Grav Learn Theme](https://learn.getgrav.org/). + +### 红色变量 + +```toml +[params] + # Change default color scheme with a variant one. Can be "red", "blue", "green". + themeVariant = "red" +``` + +![Red variant](/en/basics/style-customization/images/red-variant.png?width=60pc) + +### 蓝色变量 + +```toml +[params] + # Change default color scheme with a variant one. Can be "red", "blue", "green". + themeVariant = "blue" +``` + +![Blue variant](/en/basics/style-customization/images/blue-variant.png?width=60pc) + +### 绿色变量 + +```toml +[params] + # Change default color scheme with a variant one. Can be "red", "blue", "green". + themeVariant = "green" +``` + +![Green variant](/en/basics/style-customization/images/green-variant.png?width=60pc) + +### 自定义变量 + +First, create a new CSS file in your local `static/css` folder prefixed by `theme` (e.g. with _mine_ theme `static/css/theme-mine.css`). Copy the following content and modify colors in CSS variables. + +首先,在你本地`static/css`文件夹中创建以`theme`为前缀的CSS文件 (e.g. with _mine_ theme `static/css/theme-mine.css`)。复制下面的内容,将对应CSS变量修改为需要的颜色。 + +```css + +:root{ + + --MAIN-TEXT-color:#323232; /* Color of text by default */ + --MAIN-TITLES-TEXT-color: #5e5e5e; /* Color of titles h2-h3-h4-h5 */ + --MAIN-LINK-color:#1C90F3; /* Color of links */ + --MAIN-LINK-HOVER-color:#167ad0; /* Color of hovered links */ + --MAIN-ANCHOR-color: #1C90F3; /* color of anchors on titles */ + + --MENU-HEADER-BG-color:#1C90F3; /* Background color of menu header */ + --MENU-HEADER-BORDER-color:#33a1ff; /*Color of menu header border */ + + --MENU-SEARCH-BG-color:#167ad0; /* Search field background color (by default borders + icons) */ + --MENU-SEARCH-BOX-color: #33a1ff; /* Override search field border color */ + --MENU-SEARCH-BOX-ICONS-color: #a1d2fd; /* Override search field icons color */ + + --MENU-SECTIONS-ACTIVE-BG-color:#20272b; /* Background color of the active section and its childs */ + --MENU-SECTIONS-BG-color:#252c31; /* Background color of other sections */ + --MENU-SECTIONS-LINK-color: #ccc; /* Color of links in menu */ + --MENU-SECTIONS-LINK-HOVER-color: #e6e6e6; /* Color of links in menu, when hovered */ + --MENU-SECTION-ACTIVE-CATEGORY-color: #777; /* Color of active category text */ + --MENU-SECTION-ACTIVE-CATEGORY-BG-color: #fff; /* Color of background for the active category (only) */ + + --MENU-VISITED-color: #33a1ff; /* Color of 'page visited' icons in menu */ + --MENU-SECTION-HR-color: #20272b; /* Color of
separator in menu */ + +} + +body { + color: var(--MAIN-TEXT-color) !important; +} + +textarea:focus, input[type="email"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="tel"]:focus, input[type="text"]:focus, input[type="url"]:focus, input[type="color"]:focus, input[type="date"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="month"]:focus, input[type="time"]:focus, input[type="week"]:focus, select[multiple=multiple]:focus { + border-color: none; + box-shadow: none; +} + +h2, h3, h4, h5 { + color: var(--MAIN-TITLES-TEXT-color) !important; +} + +a { + color: var(--MAIN-LINK-color); +} + +.anchor { + color: var(--MAIN-ANCHOR-color); +} + +a:hover { + color: var(--MAIN-LINK-HOVER-color); +} + +#sidebar ul li.visited > a .read-icon { + color: var(--MENU-VISITED-color); +} + +#body a.highlight:after { + display: block; + content: ""; + height: 1px; + width: 0%; + -webkit-transition: width 0.5s ease; + -moz-transition: width 0.5s ease; + -ms-transition: width 0.5s ease; + transition: width 0.5s ease; + background-color: var(--MAIN-LINK-HOVER-color); +} +#sidebar { + background-color: var(--MENU-SECTIONS-BG-color); +} +#sidebar #header-wrapper { + background: var(--MENU-HEADER-BG-color); + color: var(--MENU-SEARCH-BOX-color); + border-color: var(--MENU-HEADER-BORDER-color); +} +#sidebar .searchbox { + border-color: var(--MENU-SEARCH-BOX-color); + background: var(--MENU-SEARCH-BG-color); +} +#sidebar ul.topics > li.parent, #sidebar ul.topics > li.active { + background: var(--MENU-SECTIONS-ACTIVE-BG-color); +} +#sidebar .searchbox * { + color: var(--MENU-SEARCH-BOX-ICONS-color); +} + +#sidebar a { + color: var(--MENU-SECTIONS-LINK-color); +} + +#sidebar a:hover { + color: var(--MENU-SECTIONS-LINK-HOVER-color); +} + +#sidebar ul li.active > a { + background: var(--MENU-SECTION-ACTIVE-CATEGORY-BG-color); + color: var(--MENU-SECTION-ACTIVE-CATEGORY-color) !important; +} + +#sidebar hr { + border-color: var(--MENU-SECTION-HR-color); +} +``` + +接着, 将`themeVariant`设置为你定制主题文件的名称。就是这样。 + +```toml +[params] + # Change default color scheme with a variant one. Can be "red", "blue", "green". + themeVariant = "mine" +``` diff --git a/exampleSite/content/cont/_index.zh.md b/exampleSite/content/cont/_index.zh.md new file mode 100644 index 00000000000..1ff98179ee4 --- /dev/null +++ b/exampleSite/content/cont/_index.zh.md @@ -0,0 +1,12 @@ +--- +title: 内容 +weight: 10 +chapter: true +pre: "2. " +--- + +### 第二章 + +# 内容 + +如何快速直观地创建和组织你的内容。 diff --git a/exampleSite/content/cont/archetypes.zh.md b/exampleSite/content/cont/archetypes.zh.md new file mode 100644 index 00000000000..903ad7fff17 --- /dev/null +++ b/exampleSite/content/cont/archetypes.zh.md @@ -0,0 +1,56 @@ +--- +title: 模板 +weight: 10 +--- +使用命令:`hugo new [relative new content path]`,你可以创建一个内容文件,它的日期和标题会自动设置。这是很好的功能,但活跃的作者要求更多:[archetypes](https://gohugo.io/content/archetypes/) + +生成页面具有预配制的框架和默认的前言。请查询文档,了解不同类型页面的不同之处。 + +## 章 {#archetypes-chapter} + +为了创建一个章页面,运行下面命令。 + +``` +hugo new --kind chapter /_index.md +``` + +这会创建一个有预定义前言的页面。 + +```markdown ++++ +title = "{{ replace .Name "-" " " | title }}" +date = {{ .Date }} +weight = 5 +chapter = true +pre = "X. " ++++ + +### Chapter X + +# Some Chapter title + +Lorem Ipsum. +``` + +## 默认 + +为了创建默认页面,运行任意下列命令。 + +``` +# Either +hugo new //_index.md +# Or +hugo new /.md +``` + +这会创建一个有预定义前言的页面。 + +```markdown ++++ +title = "{{ replace .Name "-" " " | title }}" +date = {{ .Date }} +weight = 5 ++++ + +Lorem Ipsum. +``` diff --git a/exampleSite/content/cont/i18n/_index.zh.md b/exampleSite/content/cont/i18n/_index.zh.md new file mode 100644 index 00000000000..7f8691eaec1 --- /dev/null +++ b/exampleSite/content/cont/i18n/_index.zh.md @@ -0,0 +1,78 @@ +--- +date: 2016-04-09T16:50:16+02:00 +title: 国际化 +weight: 30 +--- + +**Learn theme** 完全兼容Hugo多语言模式。 + +他会提供: + +- 翻译默认文字(英语和法语)。请大家多多做贡献! +- 由多国语言内容自动生成菜单。 +- 在浏览器中切换语言。 + +![I18n menu](/en/cont/i18n/images/i18n-menu.gif) + +## 基本设置 + +学完[how Hugo handle multilingual websites](https://gohugo.io/content-management/multilingual), 在文件`config.toml`中自定义你的语言。 + +以现在的法文或英文网站为例。 + +```toml +# English is the default language +defaultContentLanguage = "en" +# Force to have /en/my-page and /fr/my-page routes, even for default language. +defaultContentLanguageInSubdir= true + +[Languages] +[Languages.en] +title = "Documentation for Hugo Learn Theme" +weight = 1 +languageName = "English" + +[Languages.fr] +title = "Documentation du thème Hugo Learn" +weight = 2 +languageName = "Français" +``` + +接着,对于每个新页面,每种语言需要一个文件,文件名附加相应语言的*id*。 + +- Single file `my-page.md` is split in two files: + - in English: `my-page.en.md` + - in French: `my-page.fr.md` +- Single file `_index.md` is split in two files: + - in English: `_index.en.md` + - in French: `_index.fr.md` + +{{% notice info %}} +注意只有翻译的页面会显示在菜单里。没有翻译的页面不会显示默认语言内容。 +{{% /notice %}} + +{{% notice tip %}} +也使用[slug](https://gohugo.io/content-management/multilingual/#translate-your-content) 前言参数来翻译网址。 +{{% /notice %}} + +## 覆盖翻译字符串 + +翻译字符串用于主题中的通用默认值 (如*Edit this page* button, *Search placeholder*等)。目前英文或者法文翻译可用,但你也可以使用另外语言或者覆盖默认值。 + +要覆盖默认值,在i18n文件夹中创建新文件`i18n/.toml`,参照`themes/hugo-theme-learn/i18n/en.toml`自行编写。 + +顺便说一下,这些翻译其他人也可以用。请花点时间提交翻译到主题[making a PR](https://github.com/matcornic/hugo-theme-learn/pulls)。 + +## 禁用语言切换 + +在浏览器中切换语言是很好的功能。但为了某些原因,你可能想禁用他。 + +只需要在文件`config.toml`中设置`disableLanguageSwitchingButton=true`就可以了。 + +```toml +[params] + # When using mulitlingual website, disable the switch language button. + disableLanguageSwitchingButton = true +``` + +![I18n menu](/en/cont/i18n/images/i18n-menu.gif) \ No newline at end of file diff --git a/exampleSite/content/cont/icons.zh.md b/exampleSite/content/cont/icons.zh.md new file mode 100644 index 00000000000..849ba568dac --- /dev/null +++ b/exampleSite/content/cont/icons.zh.md @@ -0,0 +1,41 @@ +--- +title: 图标 +weight: 27 +--- + +**Hugo-Theme-Learn**载入[**Font Awesome**](https://fontawesome.com)库,可以容易地显示Font Awesome搜集的免费图标。 + +## 查找图标 + +在[Font Awesome Gallery](https://fontawesome.com/icons?d=gallery&m=free)中查询可用的图标。注意打开 **free**过滤器,默认状态下,只有免费图标才可用。 + +例如,给页面添加一个[心形](https://fontawesome.com/icons/heart?style=solid),复制HTML内容,粘贴到Markdown中。 + +添加心形图标的HTML是这样: + +``` + +``` + +## 包含在Markdown中 + +将HTML``代码粘贴进Markdown,Font Awesome会载入相关的图标。 + +``` +Built with from Grav and Hugo +``` + +效果如下: + +Built with from Grav and Hugo + +## 定制图标 + +Font Awesome提供了多种修改图标的方法。 + +* 修改颜色 (图标会默认继承上一级的颜色) +* 缩放尺寸 +* 旋转 +* 合并其他图片 + +查询完整文档 [web fonts with CSS](https://fontawesome.com/how-to-use/web-fonts-with-css)获取更多信息。 diff --git a/exampleSite/content/cont/markdown.zh.md b/exampleSite/content/cont/markdown.zh.md new file mode 100644 index 00000000000..fee5715d54e --- /dev/null +++ b/exampleSite/content/cont/markdown.zh.md @@ -0,0 +1,703 @@ +--- +date: 2016-04-09T16:50:16+02:00 +title: Markdown语法 +weight: 15 +--- + +{{% notice note %}} +本页是伟大网页 [Grav original page](http://learn.getgrav.org/content/markdown)令人羞愧的复制。 +唯一不同在于定制图像([resizing]({{< relref "#resizing-image" >}}), [add CSS classes]({{< relref "#add-css-classes" >}})...)。 +{{% /notice%}} + +我们必须面对:编辑网页内容是件令人疲惫的事情。所见即所得(WYSIWYG)的编辑器减轻了这项工作,但他们常常带来了令人厌恶的代码,或许更糟,难看的网页。 + +**Markdown**是一个写**HTML**的更好方式,这没有常常困扰的复杂和丑陋。 + +一些主要的收益是: + +1. Markdown只包含最少的额外字符,简单易学,所以内容书写更快。 +2. 使用Markdown书写不容易出错。 +3. 可靠输出XHTML格式。 +4. 保持内容与显示分离,使网站外观不容易弄乱。 +5. 可以在你喜欢的任何文本编辑器或者Markdown应用编辑。 +6. Markdown使用充满乐趣! + +Markdown作者John Gruber这样说: + +> Markdown格式语法的首要设计目标是尽量容易阅读。作为纯文本,Markdown格式的文件应该是可以发行的原样,而不是看起来像是被标签或是格式指令标记的。Markdown的语法受现有的多种text-to-HTML过滤器,纯文本email格式是最大的单个灵感来源。 +> -- John Gruber + +Grav带有对[Markdown](http://daringfireball.net/projects/markdown/)和[Markdown Extra](https://michelf.ca/projects/php-markdown/extra/)的内建支持. 你必须在配置文件`system.yaml`中使能**Markdown Extra**。 + +别再继续等待,让我们重温下面的Markdown主要要素和转化后的HTML。 + +{{% notice info %}} + 收藏本页以备未来参考! +{{% /notice %}} + +## 标题 + +从`h1`到`h6`的标题使用`#`来构建: + +```markdown +# h1 Heading +## h2 Heading +### h3 Heading +#### h4 Heading +##### h5 Heading +###### h6 Heading +``` + +效果如下: + +# h1 Heading + + +## h2 Heading + +### h3 Heading + +#### h4 Heading + +##### h5 Heading + +###### h6 Heading + +HTML: + +```html +

h1 Heading

+

h2 Heading

+

h3 Heading

+

h4 Heading

+
h5 Heading
+
h6 Heading
+``` + +## 注释 + +注释需要兼容HTML + +```html + +``` + +下面注释**不应该**被可见: + + + +## 水平线 + +在HTML中`
`元素用来创建一个段落级别的分割线。在Markdown中,你可以用下面任一方式实现`
`: + +* `___`: 三个连续下划线 +* `---`: 三个连续横线 +* `***`: 三个连续星号 + +效果如下 +___ +--- +*** + +## 主体内容 + +在HTML中,正常编写的主题内容,纯文本会在`

`之间。 + +所以这个主体内容: + +```markdown +Lorem ipsum dolor sit amet, graecis denique ei vel, at duo primis mandamus. Et legere ocurreret pri, animal tacimates complectitur ad cum. Cu eum inermis inimicus efficiendi. Labore officiis his ex, soluta officiis concludaturque ei qui, vide sensibus vim ad. +``` + +HTML如下: + +```html +

Lorem ipsum dolor sit amet, graecis denique ei vel, at duo primis mandamus. Et legere ocurreret pri, animal tacimates complectitur ad cum. Cu eum inermis inimicus efficiendi. Labore officiis his ex, soluta officiis concludaturque ei qui, vide sensibus vim ad.

+``` + +## 强调 + +### 加粗 + +为了用粗体强调文本的片段。 + +下面文本的片段 **显示为粗体**。 + +```markdown +**rendered as bold text** +``` + +效果如下: + + +**rendered as bold text** + + +和这个HTML: + +```html +rendered as bold text +``` + +### 斜体 + +为了用斜体强调文本的片段。 + +下面文本的片段 _显示为斜体_。 + +```markdown +_rendered as italicized text_ +``` + +效果如: + + +_rendered as italicized text_ + + +和这个HTML: + +```html +rendered as italicized text +``` + +### 删除线 + +在GFM (GitHub flavored Markdown) ,你可以使用删除线。 + +```markdown +~~Strike through this text.~~ +``` + +效果如下: + +~~Strike through this text.~~ + +HTML: + +```html +Strike through this text. +``` + +## 引用块 + +用于在文档中引用其他源的内容块。 + +Add `>` before any text you want to quote. + +在想要引用的文本前面加`>`。 + +```markdown +> **Fusion Drive** combines a hard drive with a flash storage (solid-state drive) and presents it as a single logical volume with the space of both drives combined. +``` + +效果如下: + +> **Fusion Drive** combines a hard drive with a flash storage (solid-state drive) and presents it as a single logical volume with the space of both drives combined. + +和HTML: + +```html +
+

Fusion Drive combines a hard drive with a flash storage (solid-state drive) and presents it as a single logical volume with the space of both drives combined.

+
+``` + +块引用也可以是嵌套的: + +```markdown +> Donec massa lacus, ultricies a ullamcorper in, fermentum sed augue. Nunc augue augue, aliquam non hendrerit ac, commodo vel nisi. +> +> > Sed adipiscing elit vitae augue consectetur a gravida nunc vehicula. Donec auctor odio non est accumsan facilisis. Aliquam id turpis in dolor tincidunt mollis ac eu diam. +> +> Mauris sit amet ligula egestas, feugiat metus tincidunt, luctus libero. Donec congue finibus tempor. Vestibulum aliquet sollicitudin erat, ut aliquet purus posuere luctus. +``` + +效果如下: + +> Donec massa lacus, ultricies a ullamcorper in, fermentum sed augue. Nunc augue augue, aliquam non hendrerit ac, commodo vel nisi. +> +> > Sed adipiscing elit vitae augue consectetur a gravida nunc vehicula. Donec auctor odio non est accumsan facilisis. Aliquam id turpis in dolor tincidunt mollis ac eu diam. +> +> Mauris sit amet ligula egestas, feugiat metus tincidunt, luctus libero. Donec congue finibus tempor. Vestibulum aliquet sollicitudin erat, ut aliquet purus posuere luctus. + +## 通知 + +{{% notice note %}} +通知覆盖块引用语法(`>>>`)的旧机制已经弃用了。通知目前通过专用插件 [Markdown Notices](https://github.com/getgrav/grav-plugin-markdown-notices)实现。 +{{% /notice %}} + +## 列表 + +### 无序的 + +用于对项目排序无需求的列表 + +你可以使用下面任一符号实现列表项: + +```markdown +* valid bullet +- valid bullet ++ valid bullet +``` + +例如: + +```markdown ++ Lorem ipsum dolor sit amet ++ Consectetur adipiscing elit ++ Integer molestie lorem at massa ++ Facilisis in pretium nisl aliquet ++ Nulla volutpat aliquam velit + - Phasellus iaculis neque + - Purus sodales ultricies + - Vestibulum laoreet porttitor sem + - Ac tristique libero volutpat at ++ Faucibus porta lacus fringilla vel ++ Aenean sit amet erat nunc ++ Eget porttitor lorem +``` + +效果如下: + + ++ Lorem ipsum dolor sit amet ++ Consectetur adipiscing elit ++ Integer molestie lorem at massa ++ Facilisis in pretium nisl aliquet ++ Nulla volutpat aliquam velit + - Phasellus iaculis neque + - Purus sodales ultricies + - Vestibulum laoreet porttitor sem + - Ac tristique libero volutpat at ++ Faucibus porta lacus fringilla vel ++ Aenean sit amet erat nunc ++ Eget porttitor lorem + + +和HTML: + +```html +
    +
  • Lorem ipsum dolor sit amet
  • +
  • Consectetur adipiscing elit
  • +
  • Integer molestie lorem at massa
  • +
  • Facilisis in pretium nisl aliquet
  • +
  • Nulla volutpat aliquam velit +
      +
    • Phasellus iaculis neque
    • +
    • Purus sodales ultricies
    • +
    • Vestibulum laoreet porttitor sem
    • +
    • Ac tristique libero volutpat at
    • +
    +
  • +
  • Faucibus porta lacus fringilla vel
  • +
  • Aenean sit amet erat nunc
  • +
  • Eget porttitor lorem
  • +
+``` + +### 排序 + +用于对项目排序有需求的列表 + +```markdown +1. Lorem ipsum dolor sit amet +4. Consectetur adipiscing elit +2. Integer molestie lorem at massa +8. Facilisis in pretium nisl aliquet +4. Nulla volutpat aliquam velit +99. Faucibus porta lacus fringilla vel +21. Aenean sit amet erat nunc +6. Eget porttitor lorem +``` + +效果如下: + +1. Lorem ipsum dolor sit amet +2. Consectetur adipiscing elit +3. Integer molestie lorem at massa +4. Facilisis in pretium nisl aliquet +5. Nulla volutpat aliquam velit +6. Faucibus porta lacus fringilla vel +7. Aenean sit amet erat nunc +8. Eget porttitor lorem + +和下面HTML: + +```html +
    +
  1. Lorem ipsum dolor sit amet
  2. +
  3. Consectetur adipiscing elit
  4. +
  5. Integer molestie lorem at massa
  6. +
  7. Facilisis in pretium nisl aliquet
  8. +
  9. Nulla volutpat aliquam velit
  10. +
  11. Faucibus porta lacus fringilla vel
  12. +
  13. Aenean sit amet erat nunc
  14. +
  15. Eget porttitor lorem
  16. +
+``` + +**TIP**: If you just use `1.` for each number, Markdown will automatically number each item. For example: + +**提示**: 如果你每个数字都使用`1.` ,Markdown会自动给每一项编号。例如: + +```markdown +1. Lorem ipsum dolor sit amet +1. Consectetur adipiscing elit +1. Integer molestie lorem at massa +1. Facilisis in pretium nisl aliquet +1. Nulla volutpat aliquam velit +1. Faucibus porta lacus fringilla vel +1. Aenean sit amet erat nunc +1. Eget porttitor lorem +``` + +效果如下: + +1. Lorem ipsum dolor sit amet +2. Consectetur adipiscing elit +3. Integer molestie lorem at massa +4. Facilisis in pretium nisl aliquet +5. Nulla volutpat aliquam velit +6. Faucibus porta lacus fringilla vel +7. Aenean sit amet erat nunc +8. Eget porttitor lorem + +## 代码 + +### 内嵌代码 + +将内嵌代码片段放在 `` ` `` 之间。 + +```markdown +In this example, `
` should be wrapped as **code**. +``` + +效果如下: + +In this example, `
` should be wrapped as **code**. + +HTML: + +```html +

In this example, <section></section> should be wrapped as code.

+``` + +### 缩进代码 + +缩进代码至少需要添加至少两个空格,如下: + +```markdown + // Some comments + line 1 of code + line 2 of code + line 3 of code +``` + +效果如下: + + + // Some comments + line 1 of code + line 2 of code + line 3 of code + + +HTML: + +```html +
+  
+    // Some comments
+    line 1 of code
+    line 2 of code
+    line 3 of code
+  
+
+``` + +### 块代码"fences" + +使用"fences" ```` ``` ````把多行代码放到块中。 + +```markdown +Sample text here... +``` + +HTML: + +```html +
+  Sample text here...
+
+``` + +### 高亮语法 + +GFM(GitHub Flavored Markdown)也支持语法高亮。使用它最简单的方法是在"fence"的第一个代码后面直接添加语言的文件扩展名,如` ```js `,语法会自动高亮。 + +更多内容,参见[Code Highlighting]({{< ref "syntaxhighlight.md" >}})。 + +例如,对JavaScript代码进行语法高亮: + +```plaintext + ```js + grunt.initConfig({ + assemble: { + options: { + assets: 'docs/assets', + data: 'src/data/*.{json,yml}', + helpers: 'src/custom-helpers.js', + partials: ['src/partials/**/*.{hbs,md}'] + }, + pages: { + options: { + layout: 'default.hbs' + }, + files: { + './': ['src/templates/pages/index.hbs'] + } + } + } + }; + ``` +``` + +效果如下: + +```js +grunt.initConfig({ + assemble: { + options: { + assets: 'docs/assets', + data: 'src/data/*.{json,yml}', + helpers: 'src/custom-helpers.js', + partials: ['src/partials/**/*.{hbs,md}'] + }, + pages: { + options: { + layout: 'default.hbs' + }, + files: { + './': ['src/templates/pages/index.hbs'] + } + } + } +}; +``` + +## 表格 + +表格可以通过在项目之间添加|,首行下面添加-来创建。注意|不需要纵向排列。 + +```markdown +| Option | Description | +| ------ | ----------- | +| data | path to data files to supply the data that will be passed into templates. | +| engine | engine to be used for processing templates. Handlebars is the default. | +| ext | extension to be used for dest files. | +``` + +效果如下: + +| Option | Description | +| ------ | ----------- | +| data | path to data files to supply the data that will be passed into templates. | +| engine | engine to be used for processing templates. Handlebars is the default. | +| ext | extension to be used for dest files. | + +和HTML: + +```html + + + + + + + + + + + + + + + + + +
OptionDescription
datapath to data files to supply the data that will be passed into templates.
engineengine to be used for processing templates. Handlebars is the default.
extextension to be used for dest files.
+``` + +### 靠右对齐 + +设置该列文本靠右排列需要在在破折号-右侧添加冒号:。 + +```markdown +| Option | Description | +| ------:| -----------:| +| data | path to data files to supply the data that will be passed into templates. | +| engine | engine to be used for processing templates. Handlebars is the default. | +| ext | extension to be used for dest files. | +``` + +| Option | Description | +| ------:| -----------:| +| data | path to data files to supply the data that will be passed into templates. | +| engine | engine to be used for processing templates. Handlebars is the default. | +| ext | extension to be used for dest files. | + +## 链接 + +### 基本链接 + +```markdown +[Assemble](http://assemble.io) +``` + +效果如下 (鼠标悬停,没有提示): + +[Assemble](http://assemble.io) + +HTML: + +```html +Assemble +``` + +### 添加提示 + +```markdown +[Upstage](https://github.com/upstage/ "Visit Upstage!") +``` + +效果如下 (hover over the link, there should be a tooltip 鼠标悬停,有提示): + +[Upstage](https://github.com/upstage/ "Visit Upstage!") + +HTML: + +```html +Upstage +``` + +### 命名锚点 + +命名锚点可以跳转到同一页面的指定锚点。例如,每一章节: + +```markdown +# Table of Contents + * [Chapter 1](#chapter-1) + * [Chapter 2](#chapter-2) + * [Chapter 3](#chapter-3) +``` + +会跳转到这些区域: + +```markdown +## Chapter 1 +Content for chapter one. + +## Chapter 2 +Content for chapter one. + +## Chapter 3 +Content for chapter one. +``` + +**注意** 锚点位置可以随意设置,放置在文本中不引人注意的位置就可以生效。 + +## 图片 {#images} + +图片语法和链接很相似,只是前面多了个感叹号。 + +```markdown +![Minion](https://octodex.github.com/images/minion.png) +``` + +![Minion](https://octodex.github.com/images/minion.png) + +或者 + +```markdown +![Alt text](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat") +``` + +![Alt text](https://octodex.github.com/images/stormtroopocat.jpg "The Stormtroopocat") + +Like links, Images also have a footnote style syntax + +和链接一样,图片同样有脚注风格的语法。 + +### 替代用法 : 笔记图片 + +```markdown +![Alt text][id] +``` + +![Alt text][id] + +在文本后面的参考中定义URL地址: + +[id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat" + + [id]: https://octodex.github.com/images/dojocat.jpg "The Dojocat" + +### 缩放图片 + +在图片链接中添加HTTP参数`width`或者`height`来缩放图片。取值与CSS一致(默认为`auto`)。 + +```markdown +![Minion](https://octodex.github.com/images/minion.png?width=20pc) +``` + +![Minion](https://octodex.github.com/images/minion.png?width=20pc) + +```markdown +![Minion](https://octodex.github.com/images/minion.png?height=50px) +``` + +![Minion](https://octodex.github.com/images/minion.png?height=50px) + +```markdown +![Minion](https://octodex.github.com/images/minion.png?height=50px&width=300px) +``` + +![Minion](https://octodex.github.com/images/minion.png?height=50px&width=300px) + +### 添加CSS类 + +在图片链接中添加HTTP参数`classes`添加。`shadow`和`border`可用,也可以自定义其他参数。 + +```markdown +![stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg?classes=shadow) +``` + +![stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg?width=40pc&classes=shadow) + +```markdown +![stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg?classes=border) +``` + +![stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg?width=40pc&classes=border) + +```markdown +![stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg?classes=border,shadow) +``` + +![stormtroopocat](https://octodex.github.com/images/stormtroopocat.jpg?width=40pc&classes=border,shadow) + +### 灯箱 + +在图片链接中添加HTTP参数`featherlight`来关闭灯箱效果。灯箱效果默认是开启的,使用featherlight.js插件。你可以将`featherlight`定义为`false`来关闭它。(译者注:灯箱效果指点击图片弹出图片窗口) + +```markdown +![Minion](https://octodex.github.com/images/minion.png?featherlight=false) +``` +效果如下: +![Minion](https://octodex.github.com/images/minion.png?featherlight=false) \ No newline at end of file diff --git a/exampleSite/content/cont/menushortcuts.zh.md b/exampleSite/content/cont/menushortcuts.zh.md new file mode 100644 index 00000000000..d54fee5028b --- /dev/null +++ b/exampleSite/content/cont/menushortcuts.zh.md @@ -0,0 +1,108 @@ +--- +date: 2016-04-09T16:50:16+02:00 +title: 目录快捷方式 +weight: 25 +--- + +你可以在导航菜单中定义链接内容的额外目录条目或者快捷方式 + +## 基本设置 + +编辑网站配置 `config.toml`添加一个你需要的`[[menu.shortcuts]]`条目 + +当前网站的示例: + + [[menu.shortcuts]] + name = " Github repo" + identifier = "ds" + url = "https://github.com/matcornic/hugo-theme-learn" + weight = 10 + + [[menu.shortcuts]] + name = " Showcases" + url = "/showcase" + weight = 11 + + [[menu.shortcuts]] + name = " Hugo Documentation" + identifier = "hugodoc" + url = "https://gohugo.io/" + weight = 20 + + [[menu.shortcuts]] + name = " Credits" + url = "/credits" + weight = 30 + +快捷方式默认前缀一个标题。这个标题可以通过配置`disableShortcutsTitle=true`禁用。 +尽管,你希望维持标题,除非改变数值。他会随着i18n翻译字符串的配置被覆盖。 + +例如,在你的`i18n/en.toml`文件中,添加下列内容: + + [Shortcuts-Title] + other = "" + +更多请参考[hugo menu](https://gohugo.io/extras/menus/)和[hugo i18n translation strings](https://gohugo.io/content-management/multilingual/#translation-of-strings)。 + +## 配置多语言模式 {#i18n} + +如果使用多语言网站,你需要为每一种语言设置不同的菜单。在`config.toml`中,通过`Languages.`修改菜单配置前缀。 + +当前网站示例: + + [Languages] + [Languages.en] + title = "Documentation for Hugo Learn Theme" + weight = 1 + languageName = "English" + + [[Languages.en.menu.shortcuts]] + name = " Github repo" + identifier = "ds" + url = "https://github.com/matcornic/hugo-theme-learn" + weight = 10 + + [[Languages.en.menu.shortcuts]] + name = " Showcases" + url = "/showcase" + weight = 11 + + [[Languages.en.menu.shortcuts]] + name = " Hugo Documentation" + identifier = "hugodoc" + url = "https://gohugo.io/" + weight = 20 + + [[Languages.en.menu.shortcuts]] + name = " Credits" + url = "/credits" + weight = 30 + + [Languages.fr] + title = "Documentation du thème Hugo Learn" + weight = 2 + languageName = "Français" + + [[Languages.fr.menu.shortcuts]] + name = " Repo Github" + identifier = "ds" + url = "https://github.com/matcornic/hugo-theme-learn" + weight = 10 + + [[Languages.fr.menu.shortcuts]] + name = " Vitrine" + url = "/showcase" + weight = 11 + + [[Languages.fr.menu.shortcuts]] + name = " Documentation Hugo" + identifier = "hugodoc" + url = "https://gohugo.io/" + weight = 20 + + [[Languages.fr.menu.shortcuts]] + name = " Crédits" + url = "/credits" + weight = 30 + +更多内容请参考 [hugo menu](https://gohugo.io/extras/menus/)和[hugo multilingual menus](https://gohugo.io/content-management/multilingual/#menus)。 \ No newline at end of file diff --git a/exampleSite/content/cont/pages/_index.zh.md b/exampleSite/content/cont/pages/_index.zh.md new file mode 100644 index 00000000000..338462b6e4a --- /dev/null +++ b/exampleSite/content/cont/pages/_index.zh.md @@ -0,0 +1,164 @@ +--- +date: 2016-04-09T16:50:16+02:00 +title: 组织页面 +weight: 5 +--- + +在**Hugo**中,页面是网站的核心。一旦开始配置,这些页面绝对为你的文档网站增值。 + +## 文件夹 + +网站结构与[其他Hugo项目](https://gohugo.io/content/organization/)一致。一般,所有页面都会放在*content*文件夹里。 + + content + ├── level-one + │ ├── level-two + │ │ ├── level-three + │ │ │ ├── level-four + │ │ │ │ ├── _index.md <-- /level-one/level-two/level-three/level-four + │ │ │ │ ├── page-4-a.md <-- /level-one/level-two/level-three/level-four/page-4-a + │ │ │ │ ├── page-4-b.md <-- /level-one/level-two/level-three/level-four/page-4-b + │ │ │ │ └── page-4-c.md <-- /level-one/level-two/level-three/level-four/page-4-c + │ │ │ ├── _index.md <-- /level-one/level-two/level-three + │ │ │ ├── page-3-a.md <-- /level-one/level-two/level-three/page-3-a + │ │ │ ├── page-3-b.md <-- /level-one/level-two/level-three/page-3-b + │ │ │ └── page-3-c.md <-- /level-one/level-two/level-three/page-3-c + │ │ ├── _index.md <-- /level-one/level-two + │ │ ├── page-2-a.md <-- /level-one/level-two/page-2-a + │ │ ├── page-2-b.md <-- /level-one/level-two/page-2-b + │ │ └── page-2-c.md <-- /level-one/level-two/page-2-c + │ ├── _index.md <-- /level-one + │ ├── page-1-a.md <-- /level-one/page-1-a + │ ├── page-1-b.md <-- /level-one/page-1-b + │ └── page-1-c.md <-- /level-one/page-1-c + ├── _index.md <-- / + └── page-top.md <-- /page-top + +{{% notice note %}} +每个文件夹都必须有一个`_index.md`,它是`文件夹主页`。 +{{% /notice %}} + +## 类型 + +**Hugo-theme-learn**定义了两类页面: *Default* 和 *Chapter*。两类页面在每个文档层级都可以用,只是版面显示不同。 + +**Chapter**是一个用于介绍子页面的页面。它包含一个简单标题和一个分割线。分割线的下方是正文。你可以定义任意HTML作为目录的前缀。在下面一个例子中,他是一个数字,但也可以是一个[icon](https://fortawesome.github.io/Font-Awesome/)。 + +![Chapter page](/en/cont/pages/images/pages-chapter.png?width=50pc) + +```markdown ++++ +title = "Basics" +chapter = true +weight = 5 +pre = "1. " ++++ + +### Chapter 1 + +# Basics + +Discover what this Hugo theme is all about and the core-concepts behind it. +``` + +为了让**Hugo-theme-learn**识别出这是章页面,在页面的前言里设置`chapter=true`。 + +其他内容页面可以使用**Default**页面。 + +![Default page](/en/cont/pages/images/pages-default.png?width=50pc) + +```toml ++++ +title = "Installation" +weight = 15 ++++ +``` + +下面步骤可以帮你初始化新的网站。如果不了解Hugo,我们强烈建议你学习[great documentation for beginners](https://gohugo.io/overview/quickstart/)。 + +## 创建你的工程 + +Hugo中命令`new`用于创建新网站。 + +``` +hugo new site +``` + +**Hugo-theme-learn**提供[archetypes]({{< relref "cont/archetypes.zh.md" >}})帮助你创建这种页面。 + +## 前言配置 + +在*yaml*, *toml* 或者 *json*文件中,每个Hugo页面必须定义一个[前言](https://gohugo.io/content/front-matter/)。 + +在Hugo的基础上,**Hugo-theme-learn**支持下面参数: + +```toml ++++ +# Table of content (toc) is enabled by default. Set this parameter to true to disable it. +# Note: Toc is always disabled for chapter pages +disableToc = "false" +# If set, this will be used for the page's menu entry (instead of the `title` attribute) +menuTitle = "" +# The title of the page in menu will be prefixed by this HTML content +pre = "" +# The title of the page in menu will be postfixed by this HTML content +post = "" +# Set the page as a chapter, changing the way it's displayed +chapter = false +# Hide a menu entry by setting this to true +hidden = false +# Display name of this page modifier. If set, it will be displayed in the footer. +LastModifierDisplayName = "" +# Email of this page modifier. If set with LastModifierDisplayName, it will be displayed in the footer +LastModifierEmail = "" ++++ +``` + +### 在目录条目中添加图标 + +在页面前言中添加`pre`参数可以在目录标签的前面插入任意HTML代码。下面例子使用Github图标。 + +```toml ++++ +title = "Github repo" +pre = " " ++++ +``` + +![Title with icon](/en/cont/pages/images/frontmatter-icon.png) + +### 同级目录/页面条目排序 + +Hugo提供了一个控制页面顺序的[灵活方式](https://gohugo.io/content/ordering/)。 + +参数`weight`设置一个数字是最简单的方法。 + +```toml ++++ +title = "My page" +weight = 5 ++++ +``` + +### 定制化的菜单条目名称 + +**Hugo-theme-learn**默认使用页面属性`title`(或者`linkTitle`,如果定义了)作为菜单名称。 + +但页面的名称是描述自身内容的,而菜单是层级的。我们添加了参数`menuTitle`来解决这个问题。 + +例如(页面`content/install/linux.md`): + +```toml ++++ +title = "Install on Linux" +menuTitle = "Linux" ++++ +``` + +## 主页 + +为了配置主页,有三个基本选择: + +1. 在文件夹`content`中创建文件`_index.md`用*Markdown content*编写。 +2. 在文件夹`static`中创建文件 `index.html`用*HTML content*编写。 +3. 配置你的服务器自动重定位到你文档的某一页面。 diff --git a/exampleSite/content/cont/syntaxhighlight.zh.md b/exampleSite/content/cont/syntaxhighlight.zh.md new file mode 100644 index 00000000000..ce9e57d41c6 --- /dev/null +++ b/exampleSite/content/cont/syntaxhighlight.zh.md @@ -0,0 +1,90 @@ +--- +date: 2020-06-01T13:31:12+01:00 +title: 代码高亮 +weight: 16 +--- + +**Hugo-Theme-Learn**使用[highlight.js](https://highlightjs.org/)来提供代码语法高亮。 + +## Markdown语法 + +使用倒引号(backtick)和语言名称来标记代码块。高亮功能会自动检测语言。 + + + +```plaintext + ```json + [ + { + "title": "apples", + "count": [12000, 20000], + "description": {"text": "...", "sensitive": false} + }, + { + "title": "oranges", + "count": [17500, null], + "description": {"text": "...", "sensitive": false} + } + ] +``` +``` + + +效果如下: + +​```json +[ + { + "title": "apples", + "count": [12000, 20000], + "description": {"text": "...", "sensitive": false} + }, + { + "title": "oranges", + "count": [17500, null], + "description": {"text": "...", "sensitive": false} + } +] +``` + +## 支持语言 + +**Hugo-Learn-Theme**自带支持离线浏览的highlight.js。如[highlight.js download page](https://highlightjs.org/download/)描述,包含38种通用语言。 + +## 语言检测失败 + +当使用的语言不存在,高亮功能会在浏览器上显示一个警告。例如,下面代码块使用图像语言`foo`。页面上会出现了一个错误提示。 + +```plaintext + ```foo + bar +``` +``` + +​```nohighlight +Could not find the language 'foo', did you forget to load/include a language module?(anonymous) @ highlight.pack.js +``` + +## 支持额外语言 + +为了支持在highlight.js中38种通用语言以外的语言,你需要你自己版本的highlight.js,添加到你的网站内容。 + +### 下载定制 highlight.js + +访问[https://highlightjs.org/download/](https://highlightjs.org/download/),选择你需要的文件支持。请注意,语言越多包越大。 + +### 将自定义的highlight.js添加到静态资源 + +从highlight.js下载的压缩包解压缩名为`highlight.pack.js`的文件,复制到 **new** 位置。 + +```nohighlight +static/js/highlight.pack.js +``` + +**不要**替换已经存在的文件`themes/hugo-theme-learn/static/js/highlight.pack.js`。 + +放在正确路径的文件会替代主题默认文件highlight.pack.js,阻止将来的问题,如果升级默认主题文件。 + +## 更多用法 + +参见 [https://highlightjs.org/usage/](https://highlightjs.org/usage/) diff --git a/exampleSite/content/cont/tags.zh.md b/exampleSite/content/cont/tags.zh.md new file mode 100644 index 00000000000..f2b06dea47b --- /dev/null +++ b/exampleSite/content/cont/tags.zh.md @@ -0,0 +1,38 @@ +--- +date: 2018-11-29T08:41:44+01:00 +title: 标签 +weight: 40 +tags: ["documentation", "tutorial"] +--- + +*Learn theme*支持hugo的分类方法:*标签*特征。 + +## 配置 + +只需要添加标签到任意页面: + +```markdown +--- +date: 2018-11-29T08:41:44+01:00 +title: Theme tutorial +weight: 15 +tags: ["tutorial", "theme"] +--- +``` + +## 行为 + +标签会按照插入顺序显示在页面顶端。 + +每一个标签会链接到展示所有相同标签的*分类*页面。 + +## 列出所有标签 + +在`config.toml`文件中,你可以添加显示所有标签的快捷方式。 + +```toml +[[menu.shortcuts]] +name = " Tags" +url = "/tags" +weight = 30 +``` \ No newline at end of file diff --git a/exampleSite/content/credits.zh.md b/exampleSite/content/credits.zh.md new file mode 100644 index 00000000000..6ef032268b8 --- /dev/null +++ b/exampleSite/content/credits.zh.md @@ -0,0 +1,28 @@ +--- +title: 致谢 +disableToc: true +--- + +## 贡献者 + +感谢他们 让开源软件变得更好! + +{{% ghcontributors "https://api.github.com/repos/matcornic/hugo-theme-learn/contributors?per_page=100" %}} + +特别感谢 [@vjeantet](https://github.com/vjeantet) 在 [docdock](https://github.com/vjeantet/hugo-theme-docdock)( 一个hugo-theme-learn分支)。这个主题V2.0的灵感来源自他。 + +## 包和库 +* [mermaid](https://knsv.github.io/mermaid) - generation of diagram and flowchart from text in a similar manner as markdown +* [font awesome](http://fontawesome.io/) - the iconic font and CSS framework +* [jQuery](https://jquery.com) - The Write Less, Do More, JavaScript Library +* [lunr](https://lunrjs.com) - Lunr enables you to provide a great search experience without the need for external, server-side, search services... +* [horsey](https://bevacqua.github.io/horsey/) - Progressive and customizable autocomplete component +* [clipboard.js](https://zenorocha.github.io/clipboard.js) - copy text to clipboard +* [highlight.js](https://highlightjs.org) - Javascript syntax highlighter +* [modernizr](https://modernizr.com) - A JavaScript toolkit that allows web developers to use new CSS3 and HTML5 features while maintaining a fine level of control over browsers that don't support + +## 工具 + +* [Netlify](https://www.netlify.com) - Continuous deployement and hosting of this documentation +* [Hugo](https://gohugo.io/) + diff --git a/exampleSite/content/shortcodes/_index.zh.md b/exampleSite/content/shortcodes/_index.zh.md new file mode 100644 index 00000000000..c4fc372f013 --- /dev/null +++ b/exampleSite/content/shortcodes/_index.zh.md @@ -0,0 +1,16 @@ +--- +date: 2016-04-09T16:50:16+02:00 +title: 简码 +pre: "3. " +weight: 15 +--- + +Hugo选用内容格式简洁的Markdown。很多东西Markdown支持的不好,你也可以用纯HTML来拓展他的可能性。 + +但这可能是个坏主意。大家所以使用Markdown,就是因为他读起来纯净、简练,甚至没有修饰。为了保证它尽量简单,你需要避免使用HTML。 + +为了避免这个限制,Hugo创建了[简码](https://gohugo.io/extras/shortcodes/)。简码是页面中的一个简单片段。 + +**Hugo-theme-learn**在现有的基础上提供了多个简码。 + +{{%children style="h2" description="true" %}} diff --git a/exampleSite/content/shortcodes/attachments.zh.files/BachGavotteShort.mp3 b/exampleSite/content/shortcodes/attachments.zh.files/BachGavotteShort.mp3 new file mode 100644 index 00000000000..94e3d0e539c Binary files /dev/null and b/exampleSite/content/shortcodes/attachments.zh.files/BachGavotteShort.mp3 differ diff --git a/exampleSite/content/shortcodes/attachments.zh.files/Carroll_AliceAuPaysDesMerveilles.pdf b/exampleSite/content/shortcodes/attachments.zh.files/Carroll_AliceAuPaysDesMerveilles.pdf new file mode 100644 index 00000000000..97377e99b17 Binary files /dev/null and b/exampleSite/content/shortcodes/attachments.zh.files/Carroll_AliceAuPaysDesMerveilles.pdf differ diff --git a/exampleSite/content/shortcodes/attachments.zh.files/adivorciarsetoca00cape.pdf b/exampleSite/content/shortcodes/attachments.zh.files/adivorciarsetoca00cape.pdf new file mode 100644 index 00000000000..e589c73e97e Binary files /dev/null and b/exampleSite/content/shortcodes/attachments.zh.files/adivorciarsetoca00cape.pdf differ diff --git a/exampleSite/content/shortcodes/attachments.zh.files/hugo.png b/exampleSite/content/shortcodes/attachments.zh.files/hugo.png new file mode 100644 index 00000000000..48acf346c9e Binary files /dev/null and b/exampleSite/content/shortcodes/attachments.zh.files/hugo.png differ diff --git a/exampleSite/content/shortcodes/attachments.zh.files/movieselectricsheep-flock-244-32500-2.mp4 b/exampleSite/content/shortcodes/attachments.zh.files/movieselectricsheep-flock-244-32500-2.mp4 new file mode 100644 index 00000000000..9f1fe564563 Binary files /dev/null and b/exampleSite/content/shortcodes/attachments.zh.files/movieselectricsheep-flock-244-32500-2.mp4 differ diff --git a/exampleSite/content/shortcodes/attachments.zh.md b/exampleSite/content/shortcodes/attachments.zh.md new file mode 100644 index 00000000000..d9fda31b56d --- /dev/null +++ b/exampleSite/content/shortcodes/attachments.zh.md @@ -0,0 +1,78 @@ +--- +title: 附件 +description : "附件简码显示附属页面的文件列表。" +--- + +附件简码显示页面的附件列表。 + +{{% attachments /%}} + +## 用法 + +这个简码列出存储在**特定文件夹** 中的附件。 +目前,支持两种页面实现方式。 + +1. 如果你的页面是个Markdown文件,附件必须放置在一个由页面名和 **.files** 命名的 **文件夹**。 + + > * content + > * _index.md + > * page.files + > * attachment.pdf + > * page.md + +2. 如果你的页面是个 **文件夹**,附件不许放置在名为 **'files'** 的文件夹里。 + + > * content + > * _index.md + > * page + > * index.md + > * files + > * attachment.pdf + +需要注意,如果你使用多语言网站,你需要每种语言分别对应一个文件夹。 + +这就是全部! + +### 参数 + +| 参数 | 默认值 | 描述 | +|:--|:--|:--| +| title | "Attachments" | 列表标题 | +| style | "" | 从"orange", "grey", "blue" and "green"选一个合适样式 | +| pattern | ".*" | 用于根据文件名过滤附件的正则表达式,

**pattern** 必须为[正则表达式](https://en.wikipedia.org/wiki/Regular_expression)。 | + +例如: + +* 匹配扩展名'jpg', 使用 **.*jpg** (不是 *.jpg). +* 匹配扩展名 'jpg' 或者 'png', 使用 **.*(jpg|png)** + +### 示例 + +#### 扩展名为pdf或者mp4的附件列表 + + {{%/*attachments title="Related files" pattern=".*(pdf|mp4)"/*/%}} + +效果如下: + +{{%attachments title="Related files" pattern=".*(pdf|mp4)"/%}} + +#### 着色框 +##### 橙色 + {{%/*attachments style="orange" /*/%}} +效果如下: +{{% attachments style="orange" /%}} + +##### 灰色 + {{%/*attachments style="grey" /*/%}} +效果如下: +{{% attachments style="grey" /%}} + +##### 蓝色 + {{%/*attachments style="blue" /*/%}} +效果如下: +{{% attachments style="blue" /%}} + +##### 绿色 + {{%/*attachments style="green" /*/%}} +效果如下: +{{% attachments style="green" /%}} diff --git a/exampleSite/content/shortcodes/button.zh.md b/exampleSite/content/shortcodes/button.zh.md new file mode 100644 index 00000000000..f1e61aaf74a --- /dev/null +++ b/exampleSite/content/shortcodes/button.zh.md @@ -0,0 +1,18 @@ +--- +title: 按钮 +description : "页面上的漂亮按钮。" +--- + +Button简码实现一个图标可选的、可点击的按钮。 + +代码: +``` +{{%/* button href="https://getgrav.org/" */%}}Get Grav{{%/* /button */%}} +{{%/* button href="https://getgrav.org/" icon="fas fa-download" */%}}Get Grav with icon{{%/* /button */%}} +{{%/* button href="https://getgrav.org/" icon="fas fa-download" icon-position="right" */%}}Get Grav with icon right{{%/* /button */%}} +``` +效果如下: + +{{% button href="https://getgrav.org/" %}}Get Grav{{% /button %}} +{{% button href="https://getgrav.org/" icon="fas fa-download" %}}Get Grav with icon{{% /button %}} +{{% button href="https://getgrav.org/" icon="fas fa-download" icon-position="right" %}}Get Grav with icon right{{% /button %}} diff --git a/exampleSite/content/shortcodes/children/_index.zh.md b/exampleSite/content/shortcodes/children/_index.zh.md new file mode 100644 index 00000000000..293880819bb --- /dev/null +++ b/exampleSite/content/shortcodes/children/_index.zh.md @@ -0,0 +1,40 @@ +--- +title : 子页面 +description : 列出本页面的子页面 +--- + +使用子页面(children)简码列出本页面的子页面以及衍生页面(子页面的子页面)。简码默认显示子页面链接。 + +## 用法 + +| 参数 | 默认值 | 描述 | +|:--|:--|:--| +| page | _current_ | 明确需显示子页面的页面名称(部分名称)| +| style | "li" | 选择显示衍生页面的样式,可以是任何HTML标签名称 | +| showhidden | "false" | 当true时,显示从菜单中隐藏的子页面 | +| description | "false" | 是否显示列表中页面的简介,当页面没有简介时,会截取内容的前70个词[在gohugo.io的summaries中了解更多](https://gohugo.io/content/summaries/) | +| depth | 1 | 明确需显示的衍生页面深度,例如,值为2,则显示2层子页面 **提示:** 设置999会获取所有衍生页面 | +| sort | none | **Weight** - 按菜单顺序排列, **Name** - 按菜单标签的字母顺序排列, **Identifier** - 按前言的标识符的字母顺序排列, **URL** - 按网址顺序排列 | + +## 示例 + + {{%/* children */%}} + +{{% children %}} + + {{%/* children description="true" */%}} + +{{%children description="true" %}} + + {{%/* children depth="3" showhidden="true" */%}} + +{{% children depth="3" showhidden="true" %}} + + {{%/* children style="h2" depth="3" description="true" */%}} + +{{% children style="h2" depth="3" description="true" %}} + + {{%/* children style="div" depth="999" */%}} + +{{% children style="div" depth="999" %}} + diff --git a/exampleSite/content/shortcodes/children/children-1/_index.zh.md b/exampleSite/content/shortcodes/children/children-1/_index.zh.md new file mode 100644 index 00000000000..d0c5179dbca --- /dev/null +++ b/exampleSite/content/shortcodes/children/children-1/_index.zh.md @@ -0,0 +1,6 @@ ++++ +title = "page 1" +description = "This is a demo child page" ++++ + +This is a demo child page \ No newline at end of file diff --git a/exampleSite/content/shortcodes/children/children-1/children-1-1/_index.zh.md b/exampleSite/content/shortcodes/children/children-1/children-1-1/_index.zh.md new file mode 100644 index 00000000000..a4982f96edf --- /dev/null +++ b/exampleSite/content/shortcodes/children/children-1/children-1-1/_index.zh.md @@ -0,0 +1,6 @@ ++++ +title = "page 1-1" +description = "This is a demo child page" ++++ + +This is a demo child page \ No newline at end of file diff --git a/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/_index.zh.md b/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/_index.zh.md new file mode 100644 index 00000000000..5ce56f4da0b --- /dev/null +++ b/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/_index.zh.md @@ -0,0 +1,6 @@ ++++ +title = "page 1-1-1" +description = "This is a demo child page" ++++ + +This is a demo child page \ No newline at end of file diff --git a/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/_index.zh.md b/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/_index.zh.md new file mode 100644 index 00000000000..d5d9ab277bb --- /dev/null +++ b/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/_index.zh.md @@ -0,0 +1,6 @@ ++++ +title = "page 1-1-1-1" +description = "This is a demo child page" ++++ + +This is a demo child page \ No newline at end of file diff --git a/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/children-1-1-1-1-1/_index.zh.md b/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/children-1-1-1-1-1/_index.zh.md new file mode 100644 index 00000000000..883b5b218cc --- /dev/null +++ b/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/children-1-1-1-1-1/_index.zh.md @@ -0,0 +1,6 @@ ++++ +title = "page 1-1-1-1-1" +description = "This is a demo child page" ++++ + +This is a demo child page \ No newline at end of file diff --git a/exampleSite/content/shortcodes/children/children-2/_index.zh.md b/exampleSite/content/shortcodes/children/children-2/_index.zh.md new file mode 100644 index 00000000000..a96140c2559 --- /dev/null +++ b/exampleSite/content/shortcodes/children/children-2/_index.zh.md @@ -0,0 +1,11 @@ ++++ +title = "page 2" +description = "" ++++ + +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + proident, sunt in culpa qui officia deserunt mollit anim id est laborum. \ No newline at end of file diff --git a/exampleSite/content/shortcodes/children/children-2/test3.zh.md b/exampleSite/content/shortcodes/children/children-2/test3.zh.md new file mode 100644 index 00000000000..f603d4c0cb3 --- /dev/null +++ b/exampleSite/content/shortcodes/children/children-2/test3.zh.md @@ -0,0 +1,6 @@ ++++ +title = "page test 3" +description = "This is a page test" ++++ + +This is a test 3 demo child page \ No newline at end of file diff --git a/exampleSite/content/shortcodes/children/children-3/_index.zh.md b/exampleSite/content/shortcodes/children/children-3/_index.zh.md new file mode 100644 index 00000000000..f36f8616e6f --- /dev/null +++ b/exampleSite/content/shortcodes/children/children-3/_index.zh.md @@ -0,0 +1,6 @@ ++++ +title = "page 3" +description = "This is a demo child page" ++++ + +This is a demo child page, not displayed in the menu \ No newline at end of file diff --git a/exampleSite/content/shortcodes/children/children-4/_index.zh.md b/exampleSite/content/shortcodes/children/children-4/_index.zh.md new file mode 100644 index 00000000000..b9f042d811f --- /dev/null +++ b/exampleSite/content/shortcodes/children/children-4/_index.zh.md @@ -0,0 +1,7 @@ ++++ +title = "page 4" +description = "This is a demo child page" +hidden = true ++++ + +This is a demo child page, not displayed in the menu \ No newline at end of file diff --git a/exampleSite/content/shortcodes/children/test.zh.md b/exampleSite/content/shortcodes/children/test.zh.md new file mode 100644 index 00000000000..045f0a1e2e4 --- /dev/null +++ b/exampleSite/content/shortcodes/children/test.zh.md @@ -0,0 +1,6 @@ ++++ +title = "page test" +description = "This is a page test" ++++ + +This is a test demo child page \ No newline at end of file diff --git a/exampleSite/content/shortcodes/expand.zh.md b/exampleSite/content/shortcodes/expand.zh.md new file mode 100644 index 00000000000..f15d940fa4e --- /dev/null +++ b/exampleSite/content/shortcodes/expand.zh.md @@ -0,0 +1,42 @@ +--- +title : 展开 +description : "显示页面上折叠/展开的文本段落" +--- + +展开简码显示页面上折叠/展开的文本段落。 +这里是个例子。 + +{{%expand%}} +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, +quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo +consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse +cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non +proident, sunt in culpa qui officia deserunt mollit anim id est laborum. +{{%/expand%}} + +## 用法 + +这个简码用一个可选的参数定义折叠/展开图标旁边的文本。(默认值是“Expand me...”)。 + + {{%/*expand "Is this learn theme rocks ?" */%}}Yes !.{{%/* /expand*/%}} + +{{%expand "Is this learn theme rocks ?" %}}Yes !{{% /expand%}} + +# 示例 + + {{%/*expand*/%}} + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod + tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, + quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo + consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse + cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non + proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + {{%/* /expand*/%}} + +{{%expand%}}Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod +tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, +quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo +consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse +cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non +proident, sunt in culpa qui officia deserunt mollit anim id est laborum.{{% /expand%}} \ No newline at end of file diff --git a/exampleSite/content/shortcodes/mermaid.zh.md b/exampleSite/content/shortcodes/mermaid.zh.md new file mode 100644 index 00000000000..fcf3761a66e --- /dev/null +++ b/exampleSite/content/shortcodes/mermaid.zh.md @@ -0,0 +1,207 @@ +--- +title : "Mermaid" +description : "采用类似Markdown的方法根据文本生成图表和流程图。" +--- + +[Mermaid](https://mermaidjs.github.io/)是一个帮助你根据文本生成图表和流程图的库,实现方法类似于Markdown。 + +只需要插入`mermaid`简码就行了。 + +## 流程图示例 + + {{}} + graph LR; + A[Hard edge] -->|Link text| B(Round edge) + B --> C{Decision} + C -->|One| D[Result one] + C -->|Two| E[Result two] + {{}} + +效果如下: + +{{}} +graph LR; + A[Hard edge] -->|Link text| B(Round edge) + B --> C{Decision} + C -->|One| D[Result one] + C -->|Two| E[Result two] +{{}} + +## 序列图示例 + + {{}} + sequenceDiagram + participant Alice + participant Bob + Alice->>John: Hello John, how are you? + loop Healthcheck + John->John: Fight against hypochondria + end + Note right of John: Rational thoughts
prevail... + John-->Alice: Great! + John->Bob: How about you? + Bob-->John: Jolly good! + {{}} + +效果如下: + +{{}} +sequenceDiagram + participant Alice + participant Bob + Alice->>John: Hello John, how are you? + loop Healthcheck + John->John: Fight against hypochondria + end + Note right of John: Rational thoughts
prevail... + John-->Alice: Great! + John->Bob: How about you? + Bob-->John: Jolly good! +{{
}} + +## 甘特图示例 + + {{}} + gantt + dateFormat YYYY-MM-DD + title Adding GANTT diagram functionality to mermaid + section A section + Completed task :done, des1, 2014-01-06,2014-01-08 + Active task :active, des2, 2014-01-09, 3d + Future task : des3, after des2, 5d + Future task2 : des4, after des3, 5d + section Critical tasks + Completed task in the critical line :crit, done, 2014-01-06,24h + Implement parser and jison :crit, done, after des1, 2d + Create tests for parser :crit, active, 3d + Future task in critical line :crit, 5d + Create tests for renderer :2d + Add to mermaid :1d + {{}} + +效果如下: + +{{}} +gantt + dateFormat YYYY-MM-DD + title Adding GANTT diagram functionality to mermaid + section A section + Completed task :done, des1, 2014-01-06,2014-01-08 + Active task :active, des2, 2014-01-09, 3d + Future task : des3, after des2, 5d + Future task2 : des4, after des3, 5d + section Critical tasks + Completed task in the critical line :crit, done, 2014-01-06,24h + Implement parser and jison :crit, done, after des1, 2d + Create tests for parser :crit, active, 3d + Future task in critical line :crit, 5d + Create tests for renderer :2d + Add to mermaid :1d +{{}} + + +### 类示例 + + {{}} + classDiagram + Class01 <|-- AveryLongClass : Cool + Class03 *-- Class04 + Class05 o-- Class06 + Class07 .. Class08 + Class09 --> C2 : Where am i? + Class09 --* C3 + Class09 --|> Class07 + Class07 : equals() + Class07 : Object[] elementData + Class01 : size() + Class01 : int chimp + Class01 : int gorilla + Class08 <--> C2: Cool label + {{}} + +效果如下: + +{{}} +classDiagram + Class01 <|-- AveryLongClass : Cool + Class03 *-- Class04 + Class05 o-- Class06 + Class07 .. Class08 + Class09 --> C2 : Where am i? + Class09 --* C3 + Class09 --|> Class07 + Class07 : equals() + Class07 : Object[] elementData + Class01 : size() + Class01 : int chimp + Class01 : int gorilla + Class08 <--> C2: Cool label +{{}} + +### Git示例 + + {{}} + gitGraph: + options + { + "nodeSpacing": 150, + "nodeRadius": 10 + } + end + commit + branch newbranch + checkout newbranch + commit + commit + checkout master + commit + commit + merge newbranch + {{}} + +效果如下: + +{{}} +gitGraph: +options +{ + "nodeSpacing": 150, + "nodeRadius": 10 +} +end + commit + branch newbranch + checkout newbranch + commit + commit + checkout master + commit + commit + merge newbranch +{{}} + +### 状态机示例 + + {{}} + stateDiagram-v2 + open: Open Door + closed: Closed Door + locked: Locked Door + open --> closed: Close + closed --> locked: Lock + locked --> closed: Unlock + closed --> open: Open + {{}} + +效果如下: + +{{}} +stateDiagram-v2 + open: Open Door + closed: Closed Door + locked: Locked Door + open --> closed: Close + closed --> locked: Lock + locked --> closed: Unlock + closed --> open: Open +{{}} diff --git a/exampleSite/content/shortcodes/notice.zh.md b/exampleSite/content/shortcodes/notice.zh.md new file mode 100644 index 00000000000..637a464fae8 --- /dev/null +++ b/exampleSite/content/shortcodes/notice.zh.md @@ -0,0 +1,62 @@ +--- +title: 通告 +description : "帮助你结构化页面的声明。" +--- + +通告简码提供4种样式,帮助优化页面结构。 + +### Note 注意 + +``` +{{%/* notice note */%}} +A notice disclaimer +{{%/* /notice */%}} +``` + +效果如下: + +{{% notice note %}} +A notice disclaimer +{{% /notice %}} + +### Info 信息 + +``` +{{%/* notice info */%}} +An information disclaimer +{{%/* /notice */%}} +``` + +效果如下: + +{{% notice info %}} +An information disclaimer +{{% /notice %}} + +### Tip 提示 + +``` +{{%/* notice tip */%}} +A tip disclaimer +{{%/* /notice */%}} +``` + +效果如下: + +{{% notice tip %}} +A tip disclaimer +{{% /notice %}} + +### Warning 警告 + +``` +{{%/* notice warning */%}} +A warning disclaimer +{{%/* /notice */%}} +``` + +效果如下: + +{{% notice warning %}} +A warning disclaimer +{{% /notice %}} diff --git a/exampleSite/content/shortcodes/siteparam.zh.md b/exampleSite/content/shortcodes/siteparam.zh.md new file mode 100644 index 00000000000..c9d58760457 --- /dev/null +++ b/exampleSite/content/shortcodes/siteparam.zh.md @@ -0,0 +1,23 @@ +--- +title: 网站参数 +description : "获取网站参数。" +--- + +`siteparam`简码用于打印网站参数。 + +例如,在目前的网站,`config.toml`包含变量`editURL`。 + +```toml +[params] + editURL = "https://github.com/matcornic/hugo-theme-learn/edit/master/exampleSite/content/" +``` + +使用`siteparam`简码来显示它的值。 + +``` +`editURL` Value : {{%/* siteparam "editURL" */%}} +``` + +效果如下: + +`editURL` Value : {{% siteparam "editURL" %}} \ No newline at end of file diff --git a/exampleSite/content/shortcodes/tabs.zh.md b/exampleSite/content/shortcodes/tabs.zh.md new file mode 100644 index 00000000000..d110882eb47 --- /dev/null +++ b/exampleSite/content/shortcodes/tabs.zh.md @@ -0,0 +1,116 @@ +--- +title: 选项卡视图 +description : "在不同的选项卡试图中同步选择内容。" +--- + +在页面中选择查看哪部分内容。在展示多种不同语言的代码片段或者不同格式的配置时非常顺手。 + +## 代码示例 + + {{}} + {{%/* tab name="python" */%}} + ```python + print("Hello World!") + ``` + {{%/* /tab */%}} + {{%/* tab name="R" */%}} + ```R + > print("Hello World!") + ``` + {{%/* /tab */%}} + {{%/* tab name="Bash" */%}} + ```Bash + echo "Hello World!" + ``` + {{%/* /tab */%}} + {{}} + +效果如下: + +{{< tabs >}} +{{% tab name="python" %}} +```python +print("Hello World!") +``` +{{% /tab %}} +{{% tab name="R" %}} +```R +> print("Hello World!") +``` +{{% /tab %}} +{{% tab name="Bash" %}} +```Bash +echo "Hello World!" +``` +{{% /tab %}} +{{< /tabs >}} + +同一组的选项卡视图的选择状态会保持同步。 + +{{< tabs >}} +{{% tab name="python" %}} +```python +print("Hello World!") +``` +{{% /tab %}} +{{% tab name="R" %}} +```R +> print("Hello World!") +``` +{{% /tab %}} +{{% tab name="Bash" %}} +```Bash +echo "Hello World!" +``` +{{% /tab %}} +{{< /tabs >}} + +## 配置示例 + + {{}} + {{%/* tab name="json" */%}} + ```json + { + "Hello": "World" + } + ``` + {{%/* /tab */%}} + {{%/* tab name="XML" */%}} + ```xml + World + ``` + {{%/* /tab */%}} + {{%/* tab name="properties" */%}} + ```properties + Hello = World + ``` + {{%/* /tab */%}} + {{}} + +效果如下: + +{{< tabs groupId="config" >}} +{{% tab name="json" %}} +```json +{ + "Hello": "World" +} +``` +{{% /tab %}} +{{% tab name="XML" %}} +```xml +World +``` +{{% /tab %}} +{{% tab name="properties" %}} +```properties +Hello = World +``` +{{% /tab %}} +{{< /tabs >}} + +{{% notice warning %}} +当使用不同内容集的选项卡视图时,相同集合务必使用同一`groupId`,不同集合使用不同`groupId`。`groupId`默认为`'default'`。 +**在整个网站中都要考虑这点!** + 选项卡选择会根据自动存储。如果当从其他页面的`'default'`组转过来,找不到对应选项卡,所有选项卡一开始会清空。 +{{% /notice %}} diff --git a/exampleSite/content/showcase.zh.md b/exampleSite/content/showcase.zh.md new file mode 100644 index 00000000000..9085c17ee0f --- /dev/null +++ b/exampleSite/content/showcase.zh.md @@ -0,0 +1,14 @@ +--- +title: 应用案例 +disableToc: true +--- + +#### [TAT](https://ovh.github.io/tat/overview/) by OVH +![TAT image](/images/showcase/tat.png?width=50pc) + +#### [Tshark.dev](https://tshark.dev) by Ross Jacobs +![Tshark.dev image](/images/showcase/tshark_dev.png?width=50pc) + +#### [inteliver](https://docs.inteliver.com) by Amir Lavasani +![docs.inteliver.com image](/images/showcase/inteliver_docs.png?width=50pc) + diff --git a/i18n/zh-cn.toml b/i18n/zh.toml similarity index 100% rename from i18n/zh-cn.toml rename to i18n/zh.toml