Skip to content

Commit 9fbddd6

Browse files
committed
Land rapid7#9374, fix HTML parsing problems for info -d
Land rapid7#9374
2 parents 3a7a539 + 67e7ea4 commit 9fbddd6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

lib/msf/util/document_generator/normalizer.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def get_md_content(items, kb)
7878
File.open(path, 'rb') { |f| template = f.read }
7979
return template
8080
}.call
81-
md_to_html(ERB.new(@md_template).result(binding()), kb.gsub(/</, '&#x3c;'))
81+
md_to_html(ERB.new(@md_template).result(binding()), kb)
8282
end
8383

8484

@@ -104,14 +104,18 @@ def load_css
104104
# @param kb [String] Additional information to add.
105105
# @return [String] HTML document.
106106
def md_to_html(md, kb)
107-
opts = {
107+
extensions = {
108+
escape_html: true
109+
}
110+
111+
render_options = {
108112
fenced_code_blocks: true,
109113
no_intra_emphasis: true,
110-
escape_html: true,
111114
tables: true
112115
}
113116

114-
r = Redcarpet::Markdown.new(Redcarpet::Render::MsfMdHTML, opts)
117+
html_renderer = Redcarpet::Render::MsfMdHTML.new(extensions)
118+
r = Redcarpet::Markdown.new(html_renderer, render_options)
115119
ERB.new(@html_template ||= lambda {
116120
html_template = ''
117121
path = File.expand_path(File.join(Msf::Config.data_directory, 'markdown_doc', HTML_TEMPLATE))

0 commit comments

Comments
 (0)