diff --git a/lib/puppet-strings/yard/util.rb b/lib/puppet-strings/yard/util.rb
index 29a701c..3e505c2 100644
--- a/lib/puppet-strings/yard/util.rb
+++ b/lib/puppet-strings/yard/util.rb
@@ -24,7 +24,7 @@ module PuppetStrings::Yard::Util
# @return [String] HTML document with links converted
def self.github_to_yard_links(data)
data.scan(/href\=\"\#(.+)\"/).each do |bad_link|
- data.gsub!(bad_link.first, "label-#{bad_link.first.capitalize.gsub('-', '+')}")
+ data.gsub!("=\"##{bad_link.first}\"", "=\"#label-#{bad_link.first.capitalize.gsub('-', '+')}\"")
end
data
end
diff --git a/spec/unit/puppet-strings/yard/util_spec.rb b/spec/unit/puppet-strings/yard/util_spec.rb
index 3814c2e..6611284 100644
--- a/spec/unit/puppet-strings/yard/util_spec.rb
+++ b/spec/unit/puppet-strings/yard/util_spec.rb
@@ -39,5 +39,10 @@ STR
str = ''
expect(subject.github_to_yard_links(str)).to eq(str)
end
+
+ it 'leaves plain text alone' do
+ str = ' module-description'
+ expect(subject.github_to_yard_links(str)).to eq(' module-description')
+ end
end
end