diff --git a/lib/puppet-strings/markdown/table_of_contents.rb b/lib/puppet-strings/markdown/table_of_contents.rb index dd2f2a6..6db5fac 100644 --- a/lib/puppet-strings/markdown/table_of_contents.rb +++ b/lib/puppet-strings/markdown/table_of_contents.rb @@ -1,7 +1,7 @@ module PuppetStrings::Markdown module TableOfContents def self.render - final = "" + final = "## Table of Contents\n\n" [PuppetStrings::Markdown::PuppetClasses, PuppetStrings::Markdown::DefinedTypes, diff --git a/lib/puppet-strings/markdown/templates/table_of_contents.erb b/lib/puppet-strings/markdown/templates/table_of_contents.erb index d275512..52073e3 100644 --- a/lib/puppet-strings/markdown/templates/table_of_contents.erb +++ b/lib/puppet-strings/markdown/templates/table_of_contents.erb @@ -1,8 +1,8 @@ <% if group.length > 0 -%> -## <%= group_name %> +**<%= group_name %>** <% if priv -%> -### Public <%= group_name %> +_Public <%= group_name %>_ <% group.each do |item| -%> <% unless item[:private] -%> @@ -10,7 +10,7 @@ <% end -%> <% end -%> -### Private <%= group_name %> +_Private <%= group_name %>_ <% group.each do |item| -%> <% if item[:private] -%> diff --git a/spec/fixtures/unit/markdown/output.md b/spec/fixtures/unit/markdown/output.md index 7ebc635..b738f7f 100644 --- a/spec/fixtures/unit/markdown/output.md +++ b/spec/fixtures/unit/markdown/output.md @@ -1,33 +1,35 @@ # Reference -## Classes +## Table of Contents -### Public Classes +**Classes** + +_Public Classes_ * [`klass`](#klass): A simple class. -### Private Classes +_Private Classes_ * `noparams`: Overview for class noparams -## Defined types +**Defined types** * [`klass::dt`](#klassdt): A simple defined type. -## Resource types +**Resource types** * [`apt_key`](#apt_key): Example resource type using the new API. * [`database`](#database): An example database server type. -## Functions +**Functions** * [`func`](#func): A simple Puppet function. * [`func3x`](#func3x): Documentation for an example 3.x function. * [`func4x`](#func4x): An example 4.x function. * [`func4x_1`](#func4x_1): An example 4.x function with only one signature. -## Tasks +**Tasks** * [`(stdin)`](#(stdin)): Allows you to backup your database to local file. diff --git a/spec/fixtures/unit/markdown/output_with_plan.md b/spec/fixtures/unit/markdown/output_with_plan.md index 9ca179a..33cc774 100644 --- a/spec/fixtures/unit/markdown/output_with_plan.md +++ b/spec/fixtures/unit/markdown/output_with_plan.md @@ -1,37 +1,39 @@ # Reference -## Classes +## Table of Contents -### Public Classes +**Classes** + +_Public Classes_ * [`klass`](#klass): A simple class. -### Private Classes +_Private Classes_ * `noparams`: Overview for class noparams -## Defined types +**Defined types** * [`klass::dt`](#klassdt): A simple defined type. -## Resource types +**Resource types** * [`apt_key`](#apt_key): Example resource type using the new API. * [`database`](#database): An example database server type. -## Functions +**Functions** * [`func`](#func): A simple Puppet function. * [`func3x`](#func3x): Documentation for an example 3.x function. * [`func4x`](#func4x): An example 4.x function. * [`func4x_1`](#func4x_1): An example 4.x function with only one signature. -## Tasks +**Tasks** * [`(stdin)`](#(stdin)): Allows you to backup your database to local file. -## Plans +**Plans** * [`plann`](#plann): A simple plan.