Skip to content

Commit

Permalink
Add primitive DocFX website generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Orange-Panda committed Jun 9, 2024
1 parent 7d59ca1 commit bdc40b9
Show file tree
Hide file tree
Showing 29 changed files with 2,043 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Documentation~/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/_site
/api
Binary file added Documentation~/attachments/site/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Documentation~/attachments/site/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 72 additions & 0 deletions Documentation~/docfx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"metadata": [
{
"src": [
{
"src": "..",
"files": [
"**/*.cs"
]
}
],
"dest": "api",
"disableDefaultFilter": false,
"disableGitFeatures": false,
"globalNamespaceId": "Global",
"includeExplicitInterfaceImplementations": true,
"includePrivateMembers": false,
"memberLayout": "separatePages",
"allowCompilationErrors": true
}
],
"build": {
"content": [
{
"files": [
"toc.yml",
"index.md"
]
},
{
"files": [
"api/*.yml"
]
},
{
"files": [
"pages/manual/toc.yml",
"pages/manual/*.md"
]
}
],
"resource": [
{
"files": [
"attachments/**/*"
]
}
],
"template": [
"default",
"templates/singulinkfx"
],
"globalMetadata": {
"_appTitle": "Rewired Glyphs Docs",
"_appName": "Rewired Glyphs Docs",
"_appFooter": "<strong>Rewired Glyphs</strong>",
"_appFaviconPath": "attachments/site/favicon.png",
"_appLogoPath": "attachments/site/icon.png",
"_copyrightFooter": "Docs generated for Rewired-Glyphs Unity Package. Package distributed under MIT license.",
"_disableSideFilter": false,
"_enableNewTab": true,
"_disableContribution": true,
"_disableBreadcrumb": false,
"_enableSearch": true
},
"xref": [
"https://normanderwan.github.io/UnityXrefMaps/xrefmap.yml"
],
"markdownEngineName": "markdig",
"dest": "_site"
}
}
1 change: 1 addition & 0 deletions Documentation~/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Rewired Glyphs Documentation
98 changes: 98 additions & 0 deletions Documentation~/pages/manual/docs-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Docs Overview

This article explains the technologies used for our documentation then details how to install and contribute using them.

## How the Docs Website Works

This docs are generated using a tool known as [DocFX](https://github.com/dotnet/docfx). Simply put it generates a website from our codebase (referred to as the scripting API) and articles we have written (such as this very page!).

### Installing DocFX

To install the docfx tool run the following command in a terminal or command prompt window.

```
dotnet tool install -g docfx
```

> [!NOTE]
>
> You may need to [install the .NET SDK](https://dotnet.microsoft.com/en-us/download) if you receive a `Unrecognized command 'dotnet'` error
> [!NOTE]
>
> Our documentation is generated using `2.75.0`. Using an earlier version may not generate the website correctly. You can check your version using `docfx --version`.
>
> You can update your version with the `dotnet tool update -g docfx` command.
> [!CAUTION]
>
> Do *NOT* install DocFX using a package manager (such as homebrew or chocolatey). These are usually out of date and unmaintained.
### Generate Website

To generate a website from the codebase and articles run the following command from the `Documentation` folder:

```
docfx
```

> [!WARNING]
>
> Getting the `Cannot find config file docfx.json` error?
>
> Make sure you change the directory of the terminal window to the project's documentation folder using `cd`
### Viewing the Website Locally

To view the generated website after it has been generated run the following command from the `Documentation` folder:

```
docfx serve
```

You can now view the website in your browser at `http://localhost:8080`

> [!TIP]
>
> You can generate and serve the website in a single command by using an argument on the command: `docfx --serve`
## Editing Articles

To edit articles head to the `~/Documentation~/pages/*` directory of the package. Find the article you would like to edit in this directory and open it in a text editor of your choice.

These pages are all written in the `markdown` format. We recommend reviewing the [Markdown Syntax](https://www.markdownguide.org/basic-syntax/) page for an overview of the features of markdown. Since we are generating the website using DocFX we also gain access to special [DocFX Specifc Markdown Synax](https://dotnet.github.io/docfx/docs/markdown.html) which can be used in our articles.

> [!TIP]
>
> [Visual Studio Code](https://code.visualstudio.com/Download) is recommended for editing markdown files, but any text editor will do.
## Adding New Articles

To create a new article follow these steps:

1. Create a new markdown file in one of the existing directories at `~/Documentation/pages/*`
1. These directories correspond to the category the article is in.
2. Creating a new category is out of the scope of this article.
2. Within the directory you created the article modify the table of contents (`toc.yml`) file and add a reference to your new article file.
1. View [DocFX TOC Docs](http://hellosnow.github.io/docfx/tutorial/intro_toc.html) for more information.
3. Optional: Consider adding a link to your article at in the `index.md` of the category and root index.md so this article can more easily be found.

## Adding New Attachments

Want to add images to an article? Simply add the file to the `~/Documentation~/attachments/` directory and it can be referenced in your article as such:

```
![Attachment](../../attachments/manual/docs-overview/example_attachment.png)
```

Or if you want more control over the html properties:

```
<img src="../../attachments/manual/docs-overview/example_attachment.png" width="450">
```

> [!TIP]
>
> All files in the attachments folder can be referenced regardless of it's location.
>
> However, for organizational purposes you are strongly encouraged to place your attachments in a directory that is related to the article it is included in.
1 change: 1 addition & 0 deletions Documentation~/pages/manual/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Manual
7 changes: 7 additions & 0 deletions Documentation~/pages/manual/toc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
- name: 🏠 Home
href: index.md
- name: Manual
href: index.md
items:
- name: ⭐️ Docs Overview
href: docs-overview.md
74 changes: 74 additions & 0 deletions Documentation~/templates/singulinkfx/layout/_master.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}
{{!include(/^styles/.*/)}}
{{!include(/^fonts/.*/)}}
{{!include(favicon.ico)}}
{{!include(logo.svg)}}
{{!include(search-stopwords.json)}}
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
{{>partials/head}}

<body>
<!-- Header required for docfx anchor scroll to work -->
<header id="head"></header>
<div class="top-navbar">
<a class="burger-icon" onclick="toggleMenu()">
<svg name="Hamburger"
style="vertical-align: middle;"
width="34" height="34" viewBox="0 0 24 24"><path fill="currentColor" fill-rule="evenodd" clip-rule="evenodd" d="M20 6H4V9H20V6ZM4 10.999H20V13.999H4V10.999ZM4 15.999H20V18.999H4V15.999Z"></path></svg>
</a>

{{>partials/logo}}
</div>

<div class="body-content">
<div id="blackout" class="blackout" onclick="toggleMenu()"></div>

<nav id="sidebar" role="navigation">
<div class="sidebar">
{{>partials/navbar}}
<div class="sidebar-item-separator"></div>
{{^_disableToc}}
{{>partials/toc}}
{{/_disableToc}}
</div>
{{>partials/footer}}
</nav>

<main class="main-panel">
{{#_enableSearch}}
{{>partials/searchResults}}
{{/_enableSearch}}



<div role="main" class="hide-when-search" >
{{^_disableBreadcrumb}}
{{>partials/breadcrumb}}
{{/_disableBreadcrumb}}

{{^_disableContribution}}
<div id="contribution">
{{#docurl}}
<a href="{{docurl}}" class="contribution-link">{{__global.improveThisDoc}}</a>
{{/docurl}}
</div>
{{/_disableContribution}}

<article class="content wrap" id="_content" data-uid="{{uid}}">
{{!body}}
</article>
</div>

{{#_copyrightFooter}}
<div class="copyright-footer">
<span>{{_copyrightFooter}}</span>
</div>
{{/_copyrightFooter}}
</main>
</div>

{{>partials/scripts}}
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div class="footer">
{{{_appFooter}}}
{{^_appFooter}}<strong><a href='https://dotnet.github.io/docfx/'>DocFX</a> + <a href='https://www.singulink.com'>Singulink</a> = ♥</strong>{{/_appFooter}}
</div>
23 changes: 23 additions & 0 deletions Documentation~/templates/singulinkfx/partials/head.tmpl.partial
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}</title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="{{#title}}{{title}}{{/title}}{{^title}}{{>partials/title}}{{/title}} {{#_appTitle}}| {{_appTitle}} {{/_appTitle}}">
<meta name="generator" content="docfx {{_docfxVersion}}">
{{#_description}}<meta name="description" content="{{_description}}">{{/_description}}
<link rel="shortcut icon" href="{{_rel}}{{{_appFaviconPath}}}{{^_appFaviconPath}}favicon.ico{{/_appFaviconPath}}">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/styles/night-owl.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css" integrity="sha384-EvBWSlnoFgZlXJvpzS+MAUEjvN7+gcCwH+qh7GRFOGgZO0PuwOFro7qPOJnLfe7l" crossorigin="anonymous">
<link rel="stylesheet" href="{{_rel}}styles/config.css">
<link rel="stylesheet" href="{{_rel}}styles/singulink.css">
<link rel="stylesheet" href="{{_rel}}styles/main.css">
<meta property="docfx:navrel" content="{{_navRel}}">
<meta property="docfx:tocrel" content="{{_tocRel}}">
{{#_noindex}}<meta name="searchOption" content="noindex">{{/_noindex}}
{{#_enableSearch}}<meta property="docfx:rel" content="{{_rel}}">{{/_enableSearch}}
{{#_enableNewTab}}<meta property="docfx:newtab" content="true">{{/_enableNewTab}}
</head>
31 changes: 31 additions & 0 deletions Documentation~/templates/singulinkfx/partials/li.tmpl.partial
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<ul class="nav level{{level}}">
{{#items}}
{{^dropdown}}
<li>
{{^leaf}}
<span class="expand-stub"></span>
{{/leaf}}
{{#topicHref}}
<a href="{{topicHref}}" class="sidebar-item" name="{{tocHref}}" title="{{name}}">{{name}}</a>
{{/topicHref}}
{{^topicHref}}
<a>{{{name}}}</a>
{{/topicHref}}

{{^leaf}}
{{>partials/li}}
{{/leaf}}
</li>
{{/dropdown}}
{{#dropdown}}
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">{{name}} <span class="caret"></span></a>
<ul class="dropdown-menu level{{level}}">
{{>partials/dd-li}}
</ul>
</li>
{{/dropdown}}
{{/items}}
</ul>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<a class="brand" href="{{_rel}}index.html">
<img src="{{_rel}}{{{_appLogoPath}}}{{^_appLogoPath}}logo.svg{{/_appLogoPath}}" alt="{{_appName}}" class="logomark">
<span class="brand-title">{{_appName}}</span>
</a>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<h1 id="{{id}}" data-uid="{{uid}}" class="text-break">{{>partials/title}}</h1>
<div class="markdown level0 summary">{{{summary}}}</div>
<div class="markdown level0 conceptual">{{{conceptual}}}</div>
<div class="markdown level0 remarks">{{{remarks}}}</div>
{{#children}}
<h3 id="{{id}}">{{>partials/namespaceSubtitle}}</h3>
{{#children}}
<h5><xref uid="{{uid}}" altProperty="fullName" displayProperty="name"/></h5>
<section>{{{summary}}}</section>
{{/children}}
{{/children}}
19 changes: 19 additions & 0 deletions Documentation~/templates/singulinkfx/partials/navbar.tmpl.partial
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<div>
<div class="mobile-hide">
{{>partials/logo}}
</div>

{{#_enableSearch}}
<div class="sidesearch">
<form id="search" role="search" class="search">
<i class="bi bi-search search-icon"></i>
<input type="text" id="search-query" placeholder="{{__global.search}}" autocomplete="off">
</form>
</div>
{{/_enableSearch}}

<div id="navbar">
</div>
</div>
13 changes: 13 additions & 0 deletions Documentation~/templates/singulinkfx/partials/scripts.tmpl.partial
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<script src="https://code.jquery.com/jquery-3.6.3.min.js" integrity="sha256-pvPw+upLPUjgMXY0G+8O0xUf+/Im1MZjXxxgOcBQBXU=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js" integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js"></script>
<script type="text/javascript" src="{{_rel}}styles/jquery.twbsPagination.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/mark.js@8.11.1/dist/jquery.mark.min.js"></script>
<script type="text/javascript" src="{{_rel}}styles/url.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/anchor-js@5.0.0/anchor.min.js"></script>
<script type="text/javascript" src="{{_rel}}styles/docfx.js"></script>
<script type="text/javascript" src="{{_rel}}styles/main.js"></script>
<script type="text/javascript" src="{{_rel}}styles/singulink.js"></script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{{!Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.}}

<div id="search-results" style="display: none;">
<h1 class="search-list">{{__global.searchResults}} <span></span></h1>
<div class="sr-items">
<p><i class="bi bi-hourglass-split index-loading"></i></p>
</div>
<ul id="pagination" data-first={{__global.pageFirst}} data-prev={{__global.pagePrev}} data-next={{__global.pageNext}} data-last={{__global.pageLast}}></ul>
</div>
Loading

0 comments on commit bdc40b9

Please sign in to comment.