mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	Make MUNGE generated table of contents (TOC) bookmark work when there are symbols in the headline
This commit is contained in:
		@@ -75,6 +75,9 @@ func buildTOC(markdown []byte) ([]byte, error) {
 | 
				
			|||||||
		if numSharps > 0 {
 | 
							if numSharps > 0 {
 | 
				
			||||||
			indent := strings.Repeat("  ", numSharps-1)
 | 
								indent := strings.Repeat("  ", numSharps-1)
 | 
				
			||||||
			bookmark := strings.Replace(strings.ToLower(heading), " ", "-", -1)
 | 
								bookmark := strings.Replace(strings.ToLower(heading), " ", "-", -1)
 | 
				
			||||||
 | 
								// remove ' and ? in bookmarks
 | 
				
			||||||
 | 
								bookmark = strings.Replace(bookmark, "?", "", -1)
 | 
				
			||||||
 | 
								bookmark = strings.Replace(bookmark, "'", "", -1)
 | 
				
			||||||
			tocLine := fmt.Sprintf("%s- [%s](#%s)\n", indent, heading, bookmark)
 | 
								tocLine := fmt.Sprintf("%s- [%s](#%s)\n", indent, heading, bookmark)
 | 
				
			||||||
			buffer.WriteString(tocLine)
 | 
								buffer.WriteString(tocLine)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,6 +37,10 @@ func Test_buildTOC(t *testing.T) {
 | 
				
			|||||||
			"# Title\nLorem ipsum \n## Section Heading\ndolor sit amet\n```bash\n#!/bin/sh\n```",
 | 
								"# Title\nLorem ipsum \n## Section Heading\ndolor sit amet\n```bash\n#!/bin/sh\n```",
 | 
				
			||||||
			"- [Title](#title)\n  - [Section Heading](#section-heading)\n",
 | 
								"- [Title](#title)\n  - [Section Heading](#section-heading)\n",
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								"# Title\nLorem ipsum \n## Section Heading\n### Why doesn't this work?\ndolor sit amet\n",
 | 
				
			||||||
 | 
								"- [Title](#title)\n  - [Section Heading](#section-heading)\n    - [Why doesn't this work?](#why-doesnt-this-work)\n",
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	for _, c := range cases {
 | 
						for _, c := range cases {
 | 
				
			||||||
		actual, err := buildTOC([]byte(c.in))
 | 
							actual, err := buildTOC([]byte(c.in))
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,10 +25,10 @@ certainly want the docs that go with that version.</h1>
 | 
				
			|||||||
**Table of Contents**
 | 
					**Table of Contents**
 | 
				
			||||||
<!-- BEGIN MUNGE: GENERATED_TOC -->
 | 
					<!-- BEGIN MUNGE: GENERATED_TOC -->
 | 
				
			||||||
- [Admission Controllers](#admission-controllers)
 | 
					- [Admission Controllers](#admission-controllers)
 | 
				
			||||||
  - [What are they?](#what-are-they?)
 | 
					  - [What are they?](#what-are-they)
 | 
				
			||||||
  - [Why do I need them?](#why-do-i-need-them?)
 | 
					  - [Why do I need them?](#why-do-i-need-them)
 | 
				
			||||||
  - [How do I turn on an admission control plug-in?](#how-do-i-turn-on-an-admission-control-plug-in?)
 | 
					  - [How do I turn on an admission control plug-in?](#how-do-i-turn-on-an-admission-control-plug-in)
 | 
				
			||||||
  - [What does each plug-in do?](#what-does-each-plug-in-do?)
 | 
					  - [What does each plug-in do?](#what-does-each-plug-in-do)
 | 
				
			||||||
    - [AlwaysAdmit](#alwaysadmit)
 | 
					    - [AlwaysAdmit](#alwaysadmit)
 | 
				
			||||||
    - [AlwaysDeny](#alwaysdeny)
 | 
					    - [AlwaysDeny](#alwaysdeny)
 | 
				
			||||||
    - [DenyExecOnPrivileged](#denyexeconprivileged)
 | 
					    - [DenyExecOnPrivileged](#denyexeconprivileged)
 | 
				
			||||||
@@ -39,7 +39,7 @@ certainly want the docs that go with that version.</h1>
 | 
				
			|||||||
    - [NamespaceExists](#namespaceexists)
 | 
					    - [NamespaceExists](#namespaceexists)
 | 
				
			||||||
    - [NamespaceAutoProvision (deprecated)](#namespaceautoprovision-(deprecated))
 | 
					    - [NamespaceAutoProvision (deprecated)](#namespaceautoprovision-(deprecated))
 | 
				
			||||||
    - [NamespaceLifecycle](#namespacelifecycle)
 | 
					    - [NamespaceLifecycle](#namespacelifecycle)
 | 
				
			||||||
  - [Is there a recommended set of plug-ins to use?](#is-there-a-recommended-set-of-plug-ins-to-use?)
 | 
					  - [Is there a recommended set of plug-ins to use?](#is-there-a-recommended-set-of-plug-ins-to-use)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!-- END MUNGE: GENERATED_TOC -->
 | 
					<!-- END MUNGE: GENERATED_TOC -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,7 @@ certainly want the docs that go with that version.</h1>
 | 
				
			|||||||
**Table of Contents**
 | 
					**Table of Contents**
 | 
				
			||||||
<!-- BEGIN MUNGE: GENERATED_TOC -->
 | 
					<!-- BEGIN MUNGE: GENERATED_TOC -->
 | 
				
			||||||
- [Node](#node)
 | 
					- [Node](#node)
 | 
				
			||||||
  - [What is a node?](#what-is-a-node?)
 | 
					  - [What is a node?](#what-is-a-node)
 | 
				
			||||||
  - [Node Status](#node-status)
 | 
					  - [Node Status](#node-status)
 | 
				
			||||||
    - [Node Addresses](#node-addresses)
 | 
					    - [Node Addresses](#node-addresses)
 | 
				
			||||||
    - [Node Phase](#node-phase)
 | 
					    - [Node Phase](#node-phase)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ certainly want the docs that go with that version.</h1>
 | 
				
			|||||||
  - [Viewing pod status](#viewing-pod-status)
 | 
					  - [Viewing pod status](#viewing-pod-status)
 | 
				
			||||||
  - [Viewing pod output](#viewing-pod-output)
 | 
					  - [Viewing pod output](#viewing-pod-output)
 | 
				
			||||||
  - [Deleting pods](#deleting-pods)
 | 
					  - [Deleting pods](#deleting-pods)
 | 
				
			||||||
  - [What's next?](#what's-next?)
 | 
					  - [What's next?](#whats-next)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!-- END MUNGE: GENERATED_TOC -->
 | 
					<!-- END MUNGE: GENERATED_TOC -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ certainly want the docs that go with that version.</h1>
 | 
				
			|||||||
    - [Environment Variables](#environment-variables)
 | 
					    - [Environment Variables](#environment-variables)
 | 
				
			||||||
    - [DNS](#dns)
 | 
					    - [DNS](#dns)
 | 
				
			||||||
  - [Exposing the Service to the internet](#exposing-the-service-to-the-internet)
 | 
					  - [Exposing the Service to the internet](#exposing-the-service-to-the-internet)
 | 
				
			||||||
  - [What's next?](#what's-next?)
 | 
					  - [What's next?](#whats-next)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!-- END MUNGE: GENERATED_TOC -->
 | 
					<!-- END MUNGE: GENERATED_TOC -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,7 +29,7 @@ certainly want the docs that go with that version.</h1>
 | 
				
			|||||||
  - [Viewing replication controller status](#viewing-replication-controller-status)
 | 
					  - [Viewing replication controller status](#viewing-replication-controller-status)
 | 
				
			||||||
  - [Deleting replication controllers](#deleting-replication-controllers)
 | 
					  - [Deleting replication controllers](#deleting-replication-controllers)
 | 
				
			||||||
  - [Labels](#labels)
 | 
					  - [Labels](#labels)
 | 
				
			||||||
  - [What's next?](#what's-next?)
 | 
					  - [What's next?](#whats-next)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!-- END MUNGE: GENERATED_TOC -->
 | 
					<!-- END MUNGE: GENERATED_TOC -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ your pods. But there are a number of ways to get even more information about you
 | 
				
			|||||||
  - [Using ```kubectl describe pod``` to fetch details about pods](#using-```kubectl-describe-pod```-to-fetch-details-about-pods)
 | 
					  - [Using ```kubectl describe pod``` to fetch details about pods](#using-```kubectl-describe-pod```-to-fetch-details-about-pods)
 | 
				
			||||||
  - [Example: debugging Pending Pods](#example:-debugging-pending-pods)
 | 
					  - [Example: debugging Pending Pods](#example:-debugging-pending-pods)
 | 
				
			||||||
  - [Example: debugging a down/unreachable node](#example:-debugging-a-down/unreachable-node)
 | 
					  - [Example: debugging a down/unreachable node](#example:-debugging-a-down/unreachable-node)
 | 
				
			||||||
  - [What's next?](#what's-next?)
 | 
					  - [What's next?](#whats-next)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!-- END MUNGE: GENERATED_TOC -->
 | 
					<!-- END MUNGE: GENERATED_TOC -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,7 +36,7 @@ You’ve deployed your application and exposed it via a service. Now what? Kuber
 | 
				
			|||||||
  - [Updating your application without a service outage](#updating-your-application-without-a-service-outage)
 | 
					  - [Updating your application without a service outage](#updating-your-application-without-a-service-outage)
 | 
				
			||||||
  - [In-place updates of resources](#in-place-updates-of-resources)
 | 
					  - [In-place updates of resources](#in-place-updates-of-resources)
 | 
				
			||||||
  - [Disruptive updates](#disruptive-updates)
 | 
					  - [Disruptive updates](#disruptive-updates)
 | 
				
			||||||
  - [What's next?](#what's-next?)
 | 
					  - [What's next?](#whats-next)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!-- END MUNGE: GENERATED_TOC -->
 | 
					<!-- END MUNGE: GENERATED_TOC -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,7 +33,7 @@ certainly want the docs that go with that version.</h1>
 | 
				
			|||||||
  - [Liveness and readiness probes (aka health checks)](#liveness-and-readiness-probes-(aka-health-checks))
 | 
					  - [Liveness and readiness probes (aka health checks)](#liveness-and-readiness-probes-(aka-health-checks))
 | 
				
			||||||
  - [Lifecycle hooks and termination notice](#lifecycle-hooks-and-termination-notice)
 | 
					  - [Lifecycle hooks and termination notice](#lifecycle-hooks-and-termination-notice)
 | 
				
			||||||
  - [Termination message](#termination-message)
 | 
					  - [Termination message](#termination-message)
 | 
				
			||||||
  - [What's next?](#what's-next?)
 | 
					  - [What's next?](#whats-next)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!-- END MUNGE: GENERATED_TOC -->
 | 
					<!-- END MUNGE: GENERATED_TOC -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,7 +28,7 @@ certainly want the docs that go with that version.</h1>
 | 
				
			|||||||
  - [Launching a simple application](#launching-a-simple-application)
 | 
					  - [Launching a simple application](#launching-a-simple-application)
 | 
				
			||||||
  - [Exposing your application to the Internet](#exposing-your-application-to-the-internet)
 | 
					  - [Exposing your application to the Internet](#exposing-your-application-to-the-internet)
 | 
				
			||||||
  - [Killing the application](#killing-the-application)
 | 
					  - [Killing the application](#killing-the-application)
 | 
				
			||||||
  - [What's next?](#what's-next?)
 | 
					  - [What's next?](#whats-next)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<!-- END MUNGE: GENERATED_TOC -->
 | 
					<!-- END MUNGE: GENERATED_TOC -->
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,8 +25,8 @@ certainly want the docs that go with that version.</h1>
 | 
				
			|||||||
**Table of Contents**
 | 
					**Table of Contents**
 | 
				
			||||||
<!-- BEGIN MUNGE: GENERATED_TOC -->
 | 
					<!-- BEGIN MUNGE: GENERATED_TOC -->
 | 
				
			||||||
- [Replication Controller](#replication-controller)
 | 
					- [Replication Controller](#replication-controller)
 | 
				
			||||||
  - [What is a _replication controller_?](#what-is-a-_replication-controller_?)
 | 
					  - [What is a _replication controller_?](#what-is-a-_replication-controller_)
 | 
				
			||||||
  - [How does a replication controller work?](#how-does-a-replication-controller-work?)
 | 
					  - [How does a replication controller work?](#how-does-a-replication-controller-work)
 | 
				
			||||||
    - [Pod template](#pod-template)
 | 
					    - [Pod template](#pod-template)
 | 
				
			||||||
    - [Labels](#labels)
 | 
					    - [Labels](#labels)
 | 
				
			||||||
  - [Responsibilities of the replication controller](#responsibilities-of-the-replication-controller)
 | 
					  - [Responsibilities of the replication controller](#responsibilities-of-the-replication-controller)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,7 @@ certainly want the docs that go with that version.</h1>
 | 
				
			|||||||
  - [Virtual IPs and service proxies](#virtual-ips-and-service-proxies)
 | 
					  - [Virtual IPs and service proxies](#virtual-ips-and-service-proxies)
 | 
				
			||||||
  - [Multi-Port Services](#multi-port-services)
 | 
					  - [Multi-Port Services](#multi-port-services)
 | 
				
			||||||
  - [Choosing your own IP address](#choosing-your-own-ip-address)
 | 
					  - [Choosing your own IP address](#choosing-your-own-ip-address)
 | 
				
			||||||
    - [Why not use round-robin DNS?](#why-not-use-round-robin-dns?)
 | 
					    - [Why not use round-robin DNS?](#why-not-use-round-robin-dns)
 | 
				
			||||||
  - [Discovering services](#discovering-services)
 | 
					  - [Discovering services](#discovering-services)
 | 
				
			||||||
    - [Environment variables](#environment-variables)
 | 
					    - [Environment variables](#environment-variables)
 | 
				
			||||||
    - [DNS](#dns)
 | 
					    - [DNS](#dns)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user