Skip to content

Commit

Permalink
Combining syntax cheat sheet and full syntax reference pages (MarkBin…
Browse files Browse the repository at this point in the history
  • Loading branch information
jingting1412 authored Mar 4, 2024
1 parent 9336559 commit a44bdaa
Show file tree
Hide file tree
Showing 19 changed files with 164 additions and 146 deletions.
3 changes: 1 addition & 2 deletions docs/_markbind/layouts/userGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
* References :expanded:
* [CLI Commands]({{baseUrl}}/userGuide/cliCommands.html)
* [Reader-Facing Features]({{baseUrl}}/userGuide/readerFacingFeatures.html)
* [Full Syntax Reference]({{baseUrl}}/userGuide/fullSyntaxReference.html)
* [Syntax Cheat Sheet]({{baseUrl}}/userGuide/syntaxCheatSheet.html)
* [Syntax Reference]({{baseUrl}}/userGuide/syntaxReference.html)
* [`site.json` File]({{baseUrl}}/userGuide/siteJsonFile.html)
* [`.gitignore` File]({{baseUrl}}/userGuide/gitignoreFile.html)
* [Tips & Tricks]({{baseUrl}}/userGuide/tipsAndTricks.html)
Expand Down
3 changes: 1 addition & 2 deletions docs/site.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"src": [
"index.md",
"userGuide/index.md",
"userGuide/fullSyntaxReference.md",
"userGuide/syntaxCheatSheet.md",
"userGuide/syntaxReference.md",
"userGuide/readerFacingFeatures.md",
"devGuide/index.md"
],
Expand Down
3 changes: 1 addition & 2 deletions docs/ug-site.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
"src": [
"index.md",
"userGuide/index.md",
"userGuide/fullSyntaxReference.md",
"userGuide/syntaxCheatSheet.md",
"userGuide/syntaxReference.md",
"userGuide/readerFacingFeatures.md"
],
"searchable": "no"
Expand Down
4 changes: 2 additions & 2 deletions docs/userGuide/components/imagesAndDiagrams.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ The image components here provide **convenient syntax & styling abstractions** o
Diagrams, in the form of **inline PlantUML components** are also supported.
</div>

{% from "userGuide/fullSyntaxReference.md" import syntax_topics as topics %}
{% from "userGuide/syntax/fullSyntaxSet.njk" import syntax_topics as topics %}

{% macro show_topic(filename) %}
<include src="../syntax/{{ filename }}.md" />
<hr>
{% endmacro %}

{% for k,v in topics %}
{% if 'images-diagrams' in v[1] %}
{% if 'images-diagrams' in v[2] %}
{{ show_topic(k) }}
{% endif %}
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions docs/userGuide/components/navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
The components in this page are used for scaffolding **site and page navigation**.
</div>

{% from "userGuide/fullSyntaxReference.md" import syntax_topics as topics %}
{% from "userGuide/syntax/fullSyntaxSet.njk" import syntax_topics as topics %}

{% macro show_topic(filename) %}
<include src="../syntax/{{ filename }}.md" />
<hr>
{% endmacro %}

{% for k,v in topics %}
{% if 'navigation' in v[1] %}
{% if 'navigation' in v[2] %}
{{ show_topic(k) }}
{% endif %}
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions docs/userGuide/components/others.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
This page lists some other components that may be useful in creating education websites. For now, there are only question and quiz components.
</div>

{% from "userGuide/fullSyntaxReference.md" import syntax_topics as topics %}
{% from "userGuide/syntax/fullSyntaxSet.njk" import syntax_topics as topics %}

{% macro show_topic(filename) %}
<include src="../syntax/{{ filename }}.md" />
<hr>
{% endmacro %}

{% for k,v in topics %}
{% if 'others' in v[1] %}
{% if 'others' in v[2] %}
{{ show_topic(k) }}
{% endif %}
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions docs/userGuide/components/popups.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
The components in this page can be used to easily create **various forms of pop-ups** that are activated on some user action (e.g., hovering over some text). This may be useful for showing additional information related to some specific area or span of content.
</div>

{% from "userGuide/fullSyntaxReference.md" import syntax_topics as topics %}
{% from "userGuide/syntax/fullSyntaxSet.njk" import syntax_topics as topics %}

{% macro show_topic(filename) %}
<include src="../syntax/{{ filename }}.md" />
<hr>
{% endmacro %}

{% for k,v in topics %}
{% if 'popups' in v[1] %}
{% if 'popups' in v[2] %}
{{ show_topic(k) }}
{% endif %}
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions docs/userGuide/components/presentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ More specifically, you should use either:
For more information, please refer to this [section]({{baseUrl}}/userGuide/usingHtmlJavaScriptCss.html#markdown-in-html).
</box>

{% from "userGuide/fullSyntaxReference.md" import syntax_topics as topics %}
{% from "userGuide/syntax/fullSyntaxSet.njk" import syntax_topics as topics %}

{% macro show_topic(filename) %}
<include src="../syntax/{{ filename }}.md" />
<hr>
{% endmacro %}

{% for k,v in topics %}
{% if 'presentation' in v[1] %}
{% if 'presentation' in v[2] %}
{{ show_topic(k) }}
{% endif %}
{% endfor %}
Expand Down
4 changes: 2 additions & 2 deletions docs/userGuide/formattingContents.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@

</div>

{% from "userGuide/fullSyntaxReference.md" import syntax_topics as topics %}
{% from "userGuide/syntax/fullSyntaxSet.njk" import syntax_topics as topics %}

{% macro show_topic(filename) %}
<include src="./syntax/{{ filename }}.md" />
<hr>
{% endmacro %}

{% for k,v in topics %}
{% if 'basic' in v[1] %}
{% if 'basic' in v[2] %}
{{ show_topic(k) }}
{% endif %}
{% endfor %}
Expand Down
62 changes: 0 additions & 62 deletions docs/userGuide/fullSyntaxReference.md

This file was deleted.

5 changes: 2 additions & 3 deletions docs/userGuide/readerFacingFeatures.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

# Reader-Facing Features

<include src="fullSyntaxReference.md#dummy" optional />

{% from "userGuide/fullSyntaxReference.md" import syntax_topics as topics %}
{% from "userGuide/syntax/fullSyntaxSet.njk" import syntax_topics as topics %}

{% macro show_topic(filename, heading) %}

Expand All @@ -26,7 +25,7 @@
{% endmacro %}

{% for k,v in topics %}
{% if 'reader-facing' in v[1] %}
{% if 'reader-facing' in v[2] %}
{{ show_topic( k, v[0]) }}
{% endif %}
{% endfor %}
4 changes: 1 addition & 3 deletions docs/userGuide/syntax/dates.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ Thu 22/08
<div id="short" class="d-none">

<box><span>
{{ njcode('"2019-08-12" | date("DD.MM.YYYY", 10)') }} <!-- 22.08.2019 --><br/>
{{ njcode('baseDate | date(format, daysToAdd)') }} <!-- 22.08.2019 --><br/>
</span></box>

{{ "2019-08-12" | date("DD.MM.YYYY", 10) }}
</div>
71 changes: 71 additions & 0 deletions docs/userGuide/syntax/fullSyntaxSet.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{% set syntax_topics = {
headings : ['Headings', 'headings', ['basic', 'reader-facing']],
paragraphs : ['Paragraphs', 'paragraphs', ['basic']],
lineBreaks : ['Line Breaks', 'line-breaks', ['basic']],
textStyles : ['Text Styles', 'text-styles', ['basic', 'reader-facing']],
blockquotes: ['Blockquotes', 'blockquotes', ['basic', 'reader-facing']],
lists : ['Lists', 'lists', ['basic', 'reader-facing']],
code : ['Code', 'code', ['basic', 'reader-facing']],
horizontalrules : ['Horizontal Rules', 'horizontal-rules', ['basic', 'reader-facing']],
links : ['Links', 'links', ['basic', 'reader-facing']],
footnotes: ['Footnotes', 'footnotes', ['basic', 'reader-facing']],
images : ['Images', 'images', ['basic', 'reader-facing']],
attributes: ['Classes, Attributes & Identifiers', 'classes-attributes-and-amp-identifiers', ['basic', 'reader-facing']],
tables : ['Tables', 'tables', ['basic', 'reader-facing']],
emoji : ['Emoji', 'emoji', ['basic', 'reader-facing']],
icons : ['Icons', 'icons', ['basic', 'reader-facing']],
embeds : ['Embeds', 'embeds', ['basic', 'reader-facing']],
dates : ['Dates', 'dates', ['basic', 'reader-facing']],
mathformulae : ['Math Formulae', 'math-formulae', ['basic', 'reader-facing']],

frontmatter : ['Frontmatter', 'frontmatter', ['tweakingThePageStructure']],
tags : ['Tags', 'plugin-tags', ['tweakingThePageStructure']],
includes : ['Includes', 'includes', ['reusingContents']],
variables : ['Variables', 'variables', ['reusingContents']],
keywords : ['Keywords', 'keywords', ['makingTheSiteSearchable']],

badges : ['Badges', 'badges', ['presentation', 'reader-facing']],
boxes : ['Boxes', 'boxes', ['presentation', 'reader-facing']],
panels : ['Panels', 'panels', ['presentation', 'reader-facing']],
tabs : ['Tabs', 'tabs', ['presentation', 'reader-facing']],
pictures : ['Pictures', 'pictures', ['images-diagrams', 'reader-facing']],
annotations : ['Annotations', 'annotations', ['images-diagrams', 'reader-facing']],
thumbnails : ['Thumbnails', 'thumbnails', ['images-diagrams', 'reader-facing']],
diagrams : ['Diagrams', 'diagrams', ['images-diagrams', 'reader-facing']],
tree : ['Tree', 'tree', ['images-diagrams', 'reader-facing']],
tooltips : ['Tooltips', 'tooltips', ['popups', 'reader-facing']],
popovers : ['Popovers', 'popovers', ['popups', 'reader-facing']],
modals : ['Modals', 'modals', ['popups', 'reader-facing']],
dropdowns : ['Dropdowns', 'dropdowns', ['navigation', 'reader-facing']],
searchBars : ['Search Bars', 'search-bars', ['navigation', 'reader-facing']],
navBars : ['Nav Bars', 'navbars', ['navigation', 'reader-facing']],
breadcrumbs : ['Breadcrumbs', 'breadcrumbs', ['navigation', 'reader-facing']],
siteNavigationMenus : ['Site Navigation Menus', 'site-navigation-menus', ['navigation', 'reader-facing']],
pageNavigationMenus : ['Page Navigation Menus', 'page-navigation-menus', ['navigation', 'reader-facing']],
scrollTopButton : ['Scroll To Top Button', 'scroll-to-top-button', ['navigation', 'reader-facing']],
questions : ['Questions and Quizzes', 'questions-and-quizzes', ['others', 'reader-facing']]
} %}

{% macro generate_url(k, v) %}
{% set url="/userGuide/" %}
{% if v[2] is iterable %}
{% if 'basic' in v[2] %}
{% set url = url + "formattingContents.html#" + v[1] %}
{% elif 'presentation' in v[2] %}
{% set url = url + "components/presentation.html#" + v[1] %}
{% elif 'images-diagrams' in v[2] %}
{% set url = url + "components/imagesAndDiagrams.html#" + v[1] %}
{% elif 'popups' in v[2] %}
{% set url = url + "components/popups.html#" + v[1] %}
{% elif 'navigation' in v[2] %}
{% set url = url + "components/navigation.html#" + v[1] %}
{% elif 'others' in v[2] %}
{% set url = url + "components/others.html#" + v[1] %}
{% else %}
{% set url = url + v[2][0] + v[1] %}
{% endif %}
{% else %}
{% set url = url %}
{% endif%}
{{ url }}
{% endmacro %}
30 changes: 4 additions & 26 deletions docs/userGuide/syntax/pageNavigationMenus.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ You can specify multiple `<page-nav-print />` components in a page and they do n
{{ icon_example }}
In the page that you want to have page navigation printed (i.e. to serve as a table of content when viewed on PDFs), use the `<page-nav-print />` component to position the pageNav like so:

<div id="short" class="indented">

```html
<frontmatter>
pageNav: 2
Expand All @@ -47,6 +49,8 @@ In the page that you want to have page navigation printed (i.e. to serve as a ta
Content of the page...
```

</div>

To view the pageNav on print, open the print preview of the page using the browser's print function.

<box type="info" seamless>
Expand All @@ -57,32 +61,6 @@ You can try it out by going to our [CLI Commands page]({{baseUrl}}/userGuide/cli

</panel>

<div id="short" class="indented">

{{ icon_example }}
In the page that you want to have page navigation, you may show only `<h1>` and `<h2>` headings in the pageNav, and set a custom pageNav title like so:

```html
<frontmatter>
pageNav: 2
pageNavTitle: "Chapters of This Page"
</frontmatter>
```

Then, in your [layout file]({{baseUrl}}/userGuide/tweakingThePageStructure.html#layouts), use the `<page-nav />` component to position the pageNav.

{% if not doNotShowPageNav %}
{{ icon_example }} <trigger for="modal:page-nav-example" trigger="click">Example usage of the `<page-nav />` component</trigger>

<modal header="Using the `pageNav` variable in a layout" id="modal:page-nav-example" large>
<include src="../tweakingThePageStructure.md#layout-code-snippet">
<variable name="highlightLines">54</variable>
</include>
</modal>
{% endif %}

</div>

</div>

<div id="examples" class="d-none">
Expand Down
18 changes: 16 additions & 2 deletions docs/userGuide/syntax/siteNavigationMenus.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Steps to add a siteNav:
2. Include it under a `<site-nav>` element.
3. (Optional) To make siteNav accessible on smaller screens, you can use the `<site-nav-button />` component in the [navbar]({{baseUrl}}/userGuide/components/navigation.html#navbars).

<div id="short">

<include src="codeAndOutput.md" boilerplate >
<variable name="code">
Expand All @@ -25,7 +24,6 @@ Steps to add a siteNav:
</variable>
</include>

</div>

MarkBind has styles nested lists with additional padding and smaller text sizes up to **4** nesting levels.
Beyond that, you'd have to include your own styles.
Expand All @@ -37,3 +35,19 @@ You can **append the `:expanded:` to a <tooltip content="a menu item with sub me
</div>

<div id="examples"></div>

<div id="short" class="d-none">

```html
<site-nav>
* [**Getting Started**]({{baseUrl}}/userGuide/gettingStarted.html)
* **Authoring Contents** :expanded:
* [Overview]({{baseUrl}}/userGuide/authoringContents.html)
* [Adding Pages]({{baseUrl}}/userGuide/addingPages.html)
* [MarkBind Syntax Overview]({{baseUrl}}/userGuide/markBindSyntaxOverview.html)
* [Formatting Contents]({{baseUrl}}/userGuide/formattingContents.html)
* [Using Components]({{baseUrl}}/userGuide/usingComponents.html)
</site-nav>
```

</div>
Loading

0 comments on commit a44bdaa

Please sign in to comment.