Skip to content

Commit 6e4ec38

Browse files
committed
Make TOC munge include blank line before TOC
1 parent 816f18a commit 6e4ec38

31 files changed

+38
-9
lines changed

cmd/mungedocs/toc.go

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ func updateTOC(filePath string, markdown []byte) ([]byte, error) {
5454
// builds the ToC.
5555
func buildTOC(markdown []byte) ([]byte, error) {
5656
var buffer bytes.Buffer
57+
buffer.WriteString("\n")
5758
scanner := bufio.NewScanner(bytes.NewReader(markdown))
5859
inBlockQuotes := false
5960
for scanner.Scan() {

cmd/mungedocs/toc_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,19 @@ func Test_buildTOC(t *testing.T) {
2727
in string
2828
out string
2929
}{
30-
{"", ""},
31-
{"Lorem ipsum\ndolor sit amet\n", ""},
30+
{"", "\n"},
31+
{"Lorem ipsum\ndolor sit amet\n", "\n"},
3232
{
3333
"# Title\nLorem ipsum \n## Section Heading\ndolor sit amet\n",
34-
"- [Title](#title)\n - [Section Heading](#section-heading)\n",
34+
"\n- [Title](#title)\n - [Section Heading](#section-heading)\n",
3535
},
3636
{
3737
"# Title\nLorem ipsum \n## Section Heading\ndolor sit amet\n```bash\n#!/bin/sh\n```",
38-
"- [Title](#title)\n - [Section Heading](#section-heading)\n",
38+
"\n- [Title](#title)\n - [Section Heading](#section-heading)\n",
3939
},
4040
{
4141
"# Title\nLorem ipsum \n## Section Heading\n### Ok, why doesn't this work? ...add 4 *more* `symbols`!\ndolor sit amet\n",
42-
"- [Title](#title)\n - [Section Heading](#section-heading)\n - [Ok, why doesn't this work? ...add 4 *more* `symbols`!](#ok-why-doesnt-this-work-add-4-more-symbols)\n",
42+
"\n- [Title](#title)\n - [Section Heading](#section-heading)\n - [Ok, why doesn't this work? ...add 4 *more* `symbols`!](#ok-why-doesnt-this-work-add-4-more-symbols)\n",
4343
},
4444
}
4545
for _, c := range cases {
@@ -63,7 +63,7 @@ func Test_updateTOC(t *testing.T) {
6363
},
6464
{
6565
"# Title\nLorem ipsum \n**table of contents**\n<!-- BEGIN MUNGE: GENERATED_TOC -->\nold cruft\n<!-- END MUNGE: GENERATED_TOC -->\n## Section Heading\ndolor sit amet\n",
66-
"# Title\nLorem ipsum \n**table of contents**\n<!-- BEGIN MUNGE: GENERATED_TOC -->\n- [Title](#title)\n - [Section Heading](#section-heading)\n\n<!-- END MUNGE: GENERATED_TOC -->\n## Section Heading\ndolor sit amet\n",
66+
"# Title\nLorem ipsum \n**table of contents**\n<!-- BEGIN MUNGE: GENERATED_TOC -->\n\n- [Title](#title)\n - [Section Heading](#section-heading)\n\n<!-- END MUNGE: GENERATED_TOC -->\n## Section Heading\ndolor sit amet\n",
6767
},
6868
}
6969
for _, c := range cases {

docs/admin/admission-controllers.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Documentation for other releases can be found at
3434

3535
**Table of Contents**
3636
<!-- BEGIN MUNGE: GENERATED_TOC -->
37+
3738
- [Admission Controllers](#admission-controllers)
3839
- [What are they?](#what-are-they)
3940
- [Why do I need them?](#why-do-i-need-them)

docs/admin/cluster-components.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ Example addons are:
103103
* [DNS](../../cluster/addons/dns/) provides cluster local DNS.
104104
* [kube-ui](../../cluster/addons/kube-ui/) provides a graphical UI for the
105105
cluster.
106-
* [fluentd-elasticsearch](../../cluster/addons/fluentd-elasticsearch) provides
107-
log storage. Also see the [gcp version](../../cluster/addons/fluentd-gcp).
108-
* [cluster-monitoring](../../cluster/addons/cluster-monitoring) provides
106+
* [fluentd-elasticsearch](../../cluster/addons/fluentd-elasticsearch/) provides
107+
log storage. Also see the [gcp version](../../cluster/addons/fluentd-gcp/).
108+
* [cluster-monitoring](../../cluster/addons/cluster-monitoring/) provides
109109
monitoring for the cluster.
110110

111111
## Node components

docs/admin/high-availability.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Documentation for other releases can be found at
3434

3535
**Table of Contents**
3636
<!-- BEGIN MUNGE: GENERATED_TOC -->
37+
3738
- [High Availability Kubernetes Clusters](#high-availability-kubernetes-clusters)
3839
- [Introduction](#introduction)
3940
- [Overview](#overview)

docs/admin/networking.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Documentation for other releases can be found at
3434

3535
**Table of Contents**
3636
<!-- BEGIN MUNGE: GENERATED_TOC -->
37+
3738
- [Networking in Kubernetes](#networking-in-kubernetes)
3839
- [Summary](#summary)
3940
- [Docker model](#docker-model)

docs/admin/node.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Documentation for other releases can be found at
3434

3535
**Table of Contents**
3636
<!-- BEGIN MUNGE: GENERATED_TOC -->
37+
3738
- [Node](#node)
3839
- [What is a node?](#what-is-a-node)
3940
- [Node Status](#node-status)

docs/devel/api-conventions.md

+1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ using resources with kubectl can be found in (working_with_resources.md).*
4141

4242
**Table of Contents**
4343
<!-- BEGIN MUNGE: GENERATED_TOC -->
44+
4445
- [Types (Kinds)](#types-kinds)
4546
- [Resources](#resources)
4647
- [Objects](#objects)

docs/getting-started-guides/scratch.md

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ steps that existing cluster setup scripts are making.
4848
**Table of Contents**
4949

5050
<!-- BEGIN MUNGE: GENERATED_TOC -->
51+
5152
- [Designing and Preparing](#designing-and-preparing)
5253
- [Learning](#learning)
5354
- [Cloud Provider](#cloud-provider)

docs/user-guide/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Documentation for other releases can be found at
3434

3535
**Table of Contents**
3636
<!-- BEGIN MUNGE: GENERATED_TOC -->
37+
3738
- [Kubernetes User Guide: Managing Applications](#kubernetes-user-guide-managing-applications)
3839
- [Quick walkthrough](#quick-walkthrough)
3940
- [Thorough walkthrough](#thorough-walkthrough)

docs/user-guide/accessing-the-cluster.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Documentation for other releases can be found at
3434

3535
**Table of Contents**
3636
<!-- BEGIN MUNGE: GENERATED_TOC -->
37+
3738
- [User Guide to Accessing the Cluster](#user-guide-to-accessing-the-cluster)
3839
- [Accessing the cluster API](#accessing-the-cluster-api)
3940
- [Accessing for the first time with kubectl](#accessing-for-the-first-time-with-kubectl)

docs/user-guide/application-troubleshooting.md

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ This is *not* a guide for people who want to debug their cluster. For that you
3838

3939
**Table of Contents**
4040
<!-- BEGIN MUNGE: GENERATED_TOC -->
41+
4142
- [Application Troubleshooting](#application-troubleshooting)
4243
- [FAQ](#faq)
4344
- [Diagnosing the problem](#diagnosing-the-problem)

docs/user-guide/compute-resources.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Documentation for other releases can be found at
3434

3535
** Table of Contents**
3636
<!-- BEGIN MUNGE: GENERATED_TOC -->
37+
3738
- [Compute Resources](#compute-resources)
3839
- [Container and Pod Resource Limits](#container-and-pod-resource-limits)
3940
- [How Pods with Resource Limits are Scheduled](#how-pods-with-resource-limits-are-scheduled)

docs/user-guide/configuring-containers.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Documentation for other releases can be found at
3434

3535
**Table of Contents**
3636
<!-- BEGIN MUNGE: GENERATED_TOC -->
37+
3738
- [Kubernetes User Guide: Managing Applications: Configuring and launching containers](#kubernetes-user-guide-managing-applications-configuring-and-launching-containers)
3839
- [Configuration in Kubernetes](#configuration-in-kubernetes)
3940
- [Launching a container using a configuration file](#launching-a-container-using-a-configuration-file)

docs/user-guide/connecting-applications.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Documentation for other releases can be found at
3434

3535
**Table of Contents**
3636
<!-- BEGIN MUNGE: GENERATED_TOC -->
37+
3738
- [Kubernetes User Guide: Managing Applications: Connecting applications](#kubernetes-user-guide-managing-applications-connecting-applications)
3839
- [The Kubernetes model for connecting containers](#the-kubernetes-model-for-connecting-containers)
3940
- [Exposing pods to the cluster](#exposing-pods-to-the-cluster)

docs/user-guide/container-environment.md

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Documentation for other releases can be found at
3535

3636
**Table of Contents**
3737
<!-- BEGIN MUNGE: GENERATED_TOC -->
38+
3839
- [Kubernetes Container Environment](#kubernetes-container-environment)
3940
- [Overview](#overview)
4041
- [Cluster Information](#cluster-information)

docs/user-guide/debugging-services.md

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ This document will hopefully help you to figure out what's going wrong.
3939

4040
**Table of Contents**
4141
<!-- BEGIN MUNGE: GENERATED_TOC -->
42+
4243
- [My Service is not working - how to debug](#my-service-is-not-working---how-to-debug)
4344
- [Conventions](#conventions)
4445
- [Running commands in a Pod](#running-commands-in-a-pod)

docs/user-guide/deploying-applications.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Documentation for other releases can be found at
3434

3535
**Table of Contents**
3636
<!-- BEGIN MUNGE: GENERATED_TOC -->
37+
3738
- [Kubernetes User Guide: Managing Applications: Deploying continuously running applications](#kubernetes-user-guide-managing-applications-deploying-continuously-running-applications)
3839
- [Launching a set of replicas using a configuration file](#launching-a-set-of-replicas-using-a-configuration-file)
3940
- [Viewing replication controller status](#viewing-replication-controller-status)

docs/user-guide/docker-cli-to-kubectl.md

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ In this doc, we introduce the kubernetes command line to for interacting with th
3636

3737
**Table of Contents**
3838
<!-- BEGIN MUNGE: GENERATED_TOC -->
39+
3940
- [kubectl for docker users](#kubectl-for-docker-users)
4041
- [docker run](#docker-run)
4142
- [docker ps](#docker-ps)

docs/user-guide/images.md

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ The `image` property of a container supports the same syntax as the `docker` com
4040

4141
**Table of Contents**
4242
<!-- BEGIN MUNGE: GENERATED_TOC -->
43+
4344
- [Images](#images)
4445
- [Updating Images](#updating-images)
4546
- [Using a Private Registry](#using-a-private-registry)

docs/user-guide/introspection-and-debugging.md

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ your pods. But there are a number of ways to get even more information about you
3838

3939
**Table of Contents**
4040
<!-- BEGIN MUNGE: GENERATED_TOC -->
41+
4142
- [Kubernetes User Guide: Managing Applications: Application Introspection and Debugging](#kubernetes-user-guide-managing-applications-application-introspection-and-debugging)
4243
- [Using ```kubectl describe pod``` to fetch details about pods](#using-kubectl-describe-pod-to-fetch-details-about-pods)
4344
- [Example: debugging Pending Pods](#example-debugging-pending-pods)

docs/user-guide/managing-deployments.md

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ You’ve deployed your application and exposed it via a service. Now what? Kuber
3636

3737
**Table of Contents**
3838
<!-- BEGIN MUNGE: GENERATED_TOC -->
39+
3940
- [Kubernetes User Guide: Managing Applications: Managing deployments](#kubernetes-user-guide-managing-applications-managing-deployments)
4041
- [Organizing resource configurations](#organizing-resource-configurations)
4142
- [Bulk operations in kubectl](#bulk-operations-in-kubectl)

docs/user-guide/persistent-volumes.md

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ This document describes the current state of `PersistentVolumes` in Kubernetes.
3636

3737
**Table of Contents**
3838
<!-- BEGIN MUNGE: GENERATED_TOC -->
39+
3940
- [Persistent Volumes and Claims](#persistent-volumes-and-claims)
4041
- [Introduction](#introduction)
4142
- [Lifecycle of a volume and claim](#lifecycle-of-a-volume-and-claim)

docs/user-guide/production-pods.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Documentation for other releases can be found at
3434

3535
**Table of Contents**
3636
<!-- BEGIN MUNGE: GENERATED_TOC -->
37+
3738
- [Kubernetes User Guide: Managing Applications: Working with pods and containers in production](#kubernetes-user-guide-managing-applications-working-with-pods-and-containers-in-production)
3839
- [Persistent storage](#persistent-storage)
3940
- [Distributing credentials](#distributing-credentials)

docs/user-guide/quick-start.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Documentation for other releases can be found at
3434

3535
**Table of Contents**
3636
<!-- BEGIN MUNGE: GENERATED_TOC -->
37+
3738
- [Kubernetes User Guide: Managing Applications: Quick start](#kubernetes-user-guide-managing-applications-quick-start)
3839
- [Launching a simple application](#launching-a-simple-application)
3940
- [Exposing your application to the Internet](#exposing-your-application-to-the-internet)

docs/user-guide/replication-controller.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Documentation for other releases can be found at
3434

3535
**Table of Contents**
3636
<!-- BEGIN MUNGE: GENERATED_TOC -->
37+
3738
- [Replication Controller](#replication-controller)
3839
- [What is a _replication controller_?](#what-is-a-replication-controller)
3940
- [How does a replication controller work?](#how-does-a-replication-controller-work)

docs/user-guide/secrets.md

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ a docker image. See [Secrets design document](../design/secrets.md) for more inf
3939

4040
**Table of Contents**
4141
<!-- BEGIN MUNGE: GENERATED_TOC -->
42+
4243
- [Secrets](#secrets)
4344
- [Overview of Secrets](#overview-of-secrets)
4445
- [Service Accounts Automatically Create and Use Secrets with API Credentials](#service-accounts-automatically-create-and-use-secrets-with-api-credentials)

docs/user-guide/services.md

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Documentation for other releases can be found at
3434

3535
**Table of Contents**
3636
<!-- BEGIN MUNGE: GENERATED_TOC -->
37+
3738
- [Services in Kubernetes](#services-in-kubernetes)
3839
- [Overview](#overview)
3940
- [Defining a service](#defining-a-service)

docs/user-guide/volumes.md

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ Familiarity with [pods](pods.md) is suggested.
4343

4444
**Table of Contents**
4545
<!-- BEGIN MUNGE: GENERATED_TOC -->
46+
4647
- [Volumes](#volumes)
4748
- [Background](#background)
4849
- [Types of Volumes](#types-of-volumes)

docs/user-guide/walkthrough/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ In order for the kubectl usage examples to work, make sure you have an examples
3838

3939
**Table of Contents**
4040
<!-- BEGIN MUNGE: GENERATED_TOC -->
41+
4142
- [Kubernetes 101 - Kubectl CLI and Pods](#kubernetes-101---kubectl-cli-and-pods)
4243
- [Kubectl CLI](#kubectl-cli)
4344
- [Pods](#pods)

docs/user-guide/walkthrough/k8s201.md

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ In order for the kubectl usage examples to work, make sure you have an examples
4040

4141
**Table of Contents**
4242
<!-- BEGIN MUNGE: GENERATED_TOC -->
43+
4344
- [Kubernetes 201 - Labels, Replication Controllers, Services and Health Checking](#kubernetes-201---labels-replication-controllers-services-and-health-checking)
4445
- [Labels](#labels)
4546
- [Replication Controllers](#replication-controllers)

0 commit comments

Comments
 (0)