From 1b6a08e6939dece07862f5b4c239c790427a416e Mon Sep 17 00:00:00 2001 From: johndmulhausen Date: Tue, 1 Mar 2016 18:17:31 -0800 Subject: [PATCH] Widget for code includes + sass --- _includes/code.html | 9 +++++++++ _layouts/docwithnav.html | 2 +- _sass/_base.sass | 15 ++++++++++++++- docs/admin/namespaces/index.md | 18 +----------------- docs/user-guide/walkthrough/index.md | 22 +--------------------- 5 files changed, 26 insertions(+), 40 deletions(-) create mode 100644 _includes/code.html diff --git a/_includes/code.html b/_includes/code.html new file mode 100644 index 0000000000..3120c2fd8a --- /dev/null +++ b/_includes/code.html @@ -0,0 +1,9 @@ +{% capture samplecode %}{% include_relative {{include.file}} %}{% endcapture %} +{% capture mysample %} +```{{include.language}} +{{ samplecode | raw | strip }} +``` +{% endcapture %} +

 

+ +
{{include.file}}
{{ mysample | markdownify }}
\ No newline at end of file diff --git a/_layouts/docwithnav.html b/_layouts/docwithnav.html index c06e0a6942..237cb78890 100755 --- a/_layouts/docwithnav.html +++ b/_layouts/docwithnav.html @@ -83,7 +83,7 @@ Version 1.1 Version 1.2 - + diff --git a/_sass/_base.sass b/_sass/_base.sass index e496ed2a45..bb78835701 100644 --- a/_sass/_base.sass +++ b/_sass/_base.sass @@ -699,12 +699,25 @@ section padding: 15px overflow-x: scroll - h1 code, h2 code, h3 code, h4 code, h5 code, h6 code font-family: inherit font-size: inherit background-color: transparent + .includecode, .includecode th, .includecode td + padding: 0px !important + + .includecode th + text-align: right !important + padding: 10px !important + + .includecode th a, .includecode th a code + color: white !important + background-color: transparent !important + + .includecode pre + margin: 0px !important + ul li list-style: disc diff --git a/docs/admin/namespaces/index.md b/docs/admin/namespaces/index.md index 9a8e96c57b..61382948ec 100644 --- a/docs/admin/namespaces/index.md +++ b/docs/admin/namespaces/index.md @@ -51,23 +51,7 @@ Let's create two new namespaces to hold our work. Use the file [`namespace-dev.json`](/docs/admin/namespacesnamespace-dev.json) which describes a development namespace: - - -```json -{ - "kind": "Namespace", - "apiVersion": "v1", - "metadata": { - "name": "development", - "labels": { - "name": "development" - } - } -} -``` - -[Download example](/docs/admin/namespacesnamespace-dev.json) - +{% include code.html language="json" file="namespace-dev.json" ghlink="https://github.com/kubernetes/kubernetes.github.io/blob/master/docs/admin/namespaces/namespace-dev.json" %} Create the development namespace using kubectl. diff --git a/docs/user-guide/walkthrough/index.md b/docs/user-guide/walkthrough/index.md index 959d4e3d25..6e6494946d 100644 --- a/docs/user-guide/walkthrough/index.md +++ b/docs/user-guide/walkthrough/index.md @@ -102,27 +102,7 @@ volumeMounts: Example Redis pod definition with a persistent storage volume ([pod-redis.yaml](/docs/user-guide/walkthrough/pod-redis.yaml)): - - -```yaml -apiVersion: v1 -kind: Pod -metadata: - name: redis -spec: - containers: - - name: redis - image: redis - volumeMounts: - - name: redis-persistent-storage - mountPath: /data/redis - volumes: - - name: redis-persistent-storage - emptyDir: {} -``` - -[Download example](/docs/user-guide/walkthrough/pod-redis.yaml) - +{% include code.html language="yaml" file="pod-redis.yaml" ghlink="https://github.com/kubernetes/kubernetes.github.io/blob/master/docs/user-guide/walkthrough/pod-redis.yaml" %} Notes: