Skip to content
This repository was archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
FrontMatter must not go through the markdown pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
fredemmott committed Nov 7, 2018
1 parent 82ff20c commit ae6956d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/DocumentationBuilder.hh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class DocumentationBuilder {
protected function getPageSections(
): keyset<classname<PageSections\PageSection>> {
return keyset[
PageSections\FrontMatter::class,
PageSections\NameHeading::class,
PageSections\DeprecationMessage::class,
PageSections\Summary::class,
Expand Down Expand Up @@ -110,6 +109,7 @@ class DocumentationBuilder {
$documentable['definition']->getDocComment(),
);
$ctx = $this->getContext();

$md = $this->getPageSections()
|> Vec\map($$, $s ==> (new $s($ctx, $documentable, $docs))->getMarkdown())
|> Vec\filter_nulls($$)
Expand All @@ -133,14 +133,20 @@ class DocumentationBuilder {
if ($ctx->isSyntaxHighlightingEnabled()) {
$render_ctx = $render_ctx->appendFilters(new MarkdownExt\SyntaxHighlightingFilter());
}
switch ($this->getContext()->getOutputFormat()) {
switch ($ctx->getOutputFormat()) {
case OutputFormat::MARKDOWN:
$renderer = new Markdown\MarkdownRenderer($render_ctx);
break;
case OutputFormat::HTML:
$renderer = new Markdown\HTMLRenderer($render_ctx);
break;
}
return $renderer->render($ast);
$out = $renderer->render($ast);
$fm =
(new PageSections\FrontMatter($ctx, $documentable, $docs))->getMarkdown();
if ($fm is nonnull) {
$out = $fm.$out;
}
return $out;
}
}

0 comments on commit ae6956d

Please sign in to comment.