Skip to content

Commit

Permalink
Extract helper method to render Html
Browse files Browse the repository at this point in the history
Literally just for matching the code style
  • Loading branch information
caendesilva committed Jun 26, 2024
1 parent b923262 commit 8d7b1cb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/framework/src/Support/Includes.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ public static function html(string $filename, ?string $default = null): ?HtmlStr
$path = static::normalizePath($filename, '.html');

if (! Filesystem::exists($path)) {
return $default === null ? null : new HtmlString($default);
return $default === null ? null : static::renderHtml($default);
}

return new HtmlString(Filesystem::get($path));
return static::renderHtml(Filesystem::get($path));
}

/**
Expand Down Expand Up @@ -116,6 +116,11 @@ protected static function normalizePath(string $filename, string $extension): st
return static::path(basename($filename, $extension).$extension);
}

protected static function renderHtml(string $html): HtmlString
{
return new HtmlString($html);
}

protected static function renderMarkdown(string $markdown): HtmlString
{
return new HtmlString(trim(Markdown::render($markdown, MarkdownDocument::class)));
Expand Down

0 comments on commit 8d7b1cb

Please sign in to comment.