Skip to content

Commit

Permalink
[#15] Add examples to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
michalkowal committed Jun 4, 2018
1 parent 0788ad5 commit 4331941
Show file tree
Hide file tree
Showing 18 changed files with 698 additions and 200 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -280,5 +280,8 @@ src/version.cake

# Cake.Graph related
docs/input/tasks/*.json

# Wyam
config.wyam.dll
config.wyam.hash
packages.xml
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ More about Cake at http://cakebuild.net and MkDocs at http://http://www.mkdocs.o

- [Documentation](https://michalkowal.github.io/Cake.MkDocs)

## Chat Room
Come join in the conversation about Cake.AliaSql in our Gitter Chat Room

[![Join the chat at https://gitter.im/cake-contrib/Lobby](https://badges.gitter.im/cake-contrib/Lobby.svg)](https://gitter.im/cake-contrib/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

## Build

To build this package we are using Cake.
Expand Down
56 changes: 56 additions & 0 deletions docs/input/_Bottom.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<div class="github-button">
<a href="https://github.com/michalkowal/Cake.MkDocs"><i class="fa fa-github"></i> GitHub</a>
</div>
<script>
((window.gitter = {}).chat = {}).options = {
room: 'cake-contrib/Lobby'
};
</script>
<script src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer></script>

<script type="text/javascript" src="@Context.GetLink("/assets/js/anchor.min.js")"></script>
<script type="text/javascript" src="@Context.GetLink("/assets/js/clipboard.min.js")"></script>
<script type="text/javascript">
anchors.options.placement = 'left';
anchors.add('#content > h1,h2,h3,h4');
var snippets = document.querySelectorAll("pre > code");
[].forEach.call(snippets, function(snippet) {
snippet.insertAdjacentHTML("beforebegin", "<button class='btn-copy' data-clipboard-snippet><img class='clippy' width=13 src='@Context.GetLink("/assets/images/clippy.svg")' alt='Copy to clipboard'></button>");
});
var clipboardSnippets = new Clipboard('[data-clipboard-snippet]', {
target: function(trigger) {
return trigger.nextElementSibling;
}
});
clipboardSnippets.on('success', function(e) {
e.clearSelection();
showTooltip(e.trigger, "Copied!");
});
clipboardSnippets.on('error', function(e) {
showTooltip(e.trigger, fallbackMessage(e.action));
});
var btns = document.querySelectorAll('.btn-copy');
for (var i = 0; i < btns.length; i++) {
btns[i].addEventListener('mouseleave', function(e) {
e.currentTarget.setAttribute('class', 'btn-copy');
e.currentTarget.removeAttribute('aria-label');
});
}
function showTooltip(elem, msg) {
elem.setAttribute('class', 'btn-copy tooltipped tooltipped-s');
elem.setAttribute('aria-label', msg);
}
function fallbackMessage(action) {
var actionMsg = '';
var actionKey = (action === 'cut' ? 'X' : 'C');
if (/iPhone|iPad/i.test(navigator.userAgent)) {
actionMsg = 'No support :(';
} else if (/Mac/i.test(navigator.userAgent)) {
actionMsg = 'Press ⌘-' + actionKey + ' to ' + action;
} else {
actionMsg = 'Press Ctrl-' + actionKey + ' to ' + action;
}
return actionMsg;
}
</script>
20 changes: 0 additions & 20 deletions docs/input/assets/css/override.css

This file was deleted.

122 changes: 122 additions & 0 deletions docs/input/assets/css/override.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/* Control the margin for bootstrap alert boxes */
.alert > p {
margin-top: 0px;
}

/* Control the look and feel of the copy box applied to code sections */
.btn-copy[disabled] .clippy {
opacity: .3;
}
pre .btn-copy {
-webkit-transition: opacity 0.3s ease-in-out;
-o-transition: opacity 0.3s ease-in-out;
transition: opacity 0.3s ease-in-out;
opacity: 0;
padding: 2px 6px;
float: right;
}
pre:hover .btn-copy {
opacity: 1;
}
.tooltipped {
position: relative
}
.tooltipped:after {
position: absolute;
z-index: 1000000;
display: none;
padding: 5px 8px;
font: normal normal 11px/1.5 Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
color: #fff;
text-align: center;
text-decoration: none;
text-shadow: none;
text-transform: none;
letter-spacing: normal;
word-wrap: break-word;
white-space: pre;
pointer-events: none;
content: attr(aria-label);
background: rgba(0, 0, 0, 0.8);
border-radius: 3px;
-webkit-font-smoothing: subpixel-antialiased
}
.tooltipped:before {
position: absolute;
z-index: 1000001;
display: none;
width: 0;
height: 0;
color: rgba(0, 0, 0, 0.8);
pointer-events: none;
content: "";
border: 5px solid transparent
}
.tooltipped:hover:before, .tooltipped:hover:after, .tooltipped:active:before, .tooltipped:active:after, .tooltipped:focus:before, .tooltipped:focus:after {
display: inline-block;
text-decoration: none
}
.tooltipped-s:after, .tooltipped-se:after, .tooltipped-sw:after {
top: 100%;
right: 50%;
margin-top: 5px
}
.tooltipped-s:before, .tooltipped-se:before, .tooltipped-sw:before {
top: auto;
right: 50%;
bottom: -5px;
margin-right: -5px;
border-bottom-color: rgba(0, 0, 0, 0.8)
}

@font-family-sans-serif: "Roboto", Helvetica, Arial, sans-serif;

/* For Gitter and GitHub */
.bottom-footer {
margin-bottom: 40px !important; // Make room for Gitter and GitHub buttons
}

.gitter-open-chat-button {
background-color: #3c8dbc;
font-family: @font-family-sans-serif;
letter-spacing: normal;
right: 90px;
}

.gitter-open-chat-button:focus, .gitter-open-chat-button:hover,
.github-button:focus, .github-button:hover,
{
background-color: #4EABDD;
color: #fff;
}

.gitter-chat-embed {
top: 49px;
border-top: 1px solid #000;
z-index: 10000;
}

.github-button {
z-index: 100;
position: fixed;
bottom: 0px;
right: 240px;
padding: 1em 3em;
background-color: #367fa9;
border: 0;
border-top-left-radius: 0.5em;
border-top-right-radius: 0.5em;
font-family: sans-serif;
font-size: 9pt;
text-transform: uppercase;
text-align: center;
text-decoration: none;
cursor: pointer;
cursor: hand;
-webkit-transition: all .3s ease;
transition: all .3s ease;
color: #fff;
a, a:active, a:hover, a:focus {
color: #fff;
}
}
7 changes: 7 additions & 0 deletions docs/input/docs/contributing/index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
Order: 20
Description: How to build, and run Cake.MkDocs.
---
<p>@Html.Raw(Model.String(DocsKeys.Description))</p>

@Html.Partial("_ChildPages")
51 changes: 51 additions & 0 deletions docs/input/docs/usage/build-command.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
Order: 4
---

# MkDocs build command

## MkDocs project in working directory

Build MkDocs project:

```c#
MkDocsBuild();
```

With settings:

```c#
MkDocsBuild(new MkDocsBuildSettings()
{
Dirty = true,
Theme = MkDocsTheme.ReadTheDocs
});
```

## MkDocs project in different directory

Build MkDocs in provided directory:

```c#
MkDocsBuild("./docs-project");
```
```c#
MkDocsBuild(new DirectoryPath("./docs-project"));
```

With settings:

```c#
MkDocsBuild"./docs-project", new MkDocsBuildSettings()
{
Dirty = true,
Theme = MkDocsTheme.ReadTheDocs
});
```
```c#
MkDocsBuild(new DirectoryPath("./docs-project") ,new MkDocsBuildSettings()
{
Dirty = true,
Theme = MkDocsTheme.ReadTheDocs
});
```
54 changes: 54 additions & 0 deletions docs/input/docs/usage/ghdeploy-command.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
Order: 6
---

# MkDocs GitHub Pages deploy command

> For more information see [GitHub Pages site](https://pages.github.com/)
> and [MkDocs guide](https://www.mkdocs.org/user-guide/deploying-your-docs/#github-pages).
## MkDocs project in working directory

GhDeploy MkDocs project:

```c#
MkDocsGhDeploy();
```

With settings:

```c#
MkDocsGhDeploy(new MkDocsGhDeploySettings()
{
RemoteBranch = "pages-branch",
RemoteName = "second-origin"
});
```

## MkDocs project in different directory

GhDeploy MkDocs in provided directory:

```c#
MkDocsGhDeploy("./docs-project");
```
```c#
MkDocsGhDeploy(new DirectoryPath("./docs-project"));
```

With settings:

```c#
MkDocsGhDeploy"./docs-project", new MkDocsGhDeploySettings()
{
RemoteBranch = "pages-branch",
RemoteName = "second-origin"
});
```
```c#
MkDocsGhDeploy(new DirectoryPath("./docs-project") ,new MkDocsGhDeploySettings()
{
RemoteBranch = "pages-branch",
RemoteName = "second-origin"
});
```
32 changes: 32 additions & 0 deletions docs/input/docs/usage/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
Order: 1
---

# Build Script

You can reference Cake.MkDocs in your build script as a cake addin:

```cake
#addin "Cake.MkDocs"
```

or nuget reference:

```cake
#addin "nuget:?package=Cake.MkDocs"
```

# Prerequisites

Cake.MkDocs addin use global installation of MkDocs - with correct environment variables setup like PATH and PYTHONPATH.
There is a possibility to use different installation with ToolPath property in ToolSettings (check commands examples).

MkDocs can be installed with different Package Managers on different platforms.
For more information and installation instruction see [MkDocs installation guide](https://www.mkdocs.org/#installation).

# Supported version

| Tool | Version |
| --- | --- |
| MkDocs | ~0.17.3 |
| Cake | ~0.27.2 |

0 comments on commit 4331941

Please sign in to comment.