Skip to content
Snippets Groups Projects

Allow /help to accept either page title in front matter or in Markdown

All threads resolved!
3 files
+ 71
1
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -74,7 +74,12 @@ def drawers
# Remove YAML frontmatter so that it doesn't look weird
helper_method :get_markdown_without_frontmatter
def get_markdown_without_frontmatter(path)
File.read(path).gsub(YAML_FRONT_MATTER_REGEXP, '')
markdown = File.read(path)
markdown_title_matches = markdown.match(/^title: (?<title>.+)$/)
output = [markdown.sub(YAML_FRONT_MATTER_REGEXP, '')]
output.unshift("# #{markdown_title_matches[:title]}\n") if markdown_title_matches
output.join("\n")
end
def redirect_to_documentation_website?
Loading