Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Console/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected function fire()
if ($this->input->getOption('watch')) {
return $this->watch();
}

return $this->build();
}

Expand Down Expand Up @@ -124,14 +124,14 @@ private function watch()
$affectedFiles = 0;

foreach ($currentTimestamps as $file => $mtime) {
if (!isset($fileTimestamps[$file]) || $fileTimestamps[$file] !== $mtime) {
if (! isset($fileTimestamps[$file]) || $fileTimestamps[$file] !== $mtime) {
$affectedFiles++;
$this->consoleOutput->writeln('<info>File changed: ' . $file . '</info>');
}
}

foreach ($fileTimestamps as $file => $mtime) {
if (!isset($currentTimestamps[$file])) {
if (! isset($currentTimestamps[$file])) {
$affectedFiles++;
$this->consoleOutput->writeln('<info>File deleted: ' . $file . '</info>');
}
Expand Down Expand Up @@ -221,7 +221,7 @@ private function confirmDestination()
if ($this->input->getOption('quiet') || $this->input->getOption('watch')) {
return true;
}

$customPath = Arr::get($this->app->config, 'build.destination');

if ($customPath && strpos($customPath, 'build_') !== 0 && file_exists($customPath)) {
Expand Down
1 change: 1 addition & 0 deletions src/Handlers/MarkdownHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ private function getEscapedMarkdownContent($file)
if (in_array($file->getFullExtension(), ['markdown', 'md', 'mdown'])) {
$replacements = array_merge([
'@' => "{{'@'}}",
'{@' => '{@', // Preserve {@ to avoid {{{'@'}} which is invalid Blade (e.g. {@inheritDoc})
'{{' => '@{{',
'{!!' => '@{!!',
], $replacements);
Expand Down
18 changes: 18 additions & 0 deletions tests/AtSymbolInMarkdownTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@ public function double_at_symbol_in_inline_code_block_is_parsed_to_single_at_sym
);
}

#[Test]
public function inheritdoc_annotation_in_code_block_is_preserved_in_markdown()
{
$files = $this->setupSource([
'_layouts' => [
'master.blade.php' => "<div>@yield('content')</div>",
],
'test.md' => $this->getYamlHeader() .
"```php\n{@inheritDoc}\n```",
]);
$this->buildSite($files);

$this->assertEquals(
'<div><pre><code class="language-php">{@inheritDoc}</code></pre></div>',
$this->clean($files->getChild('build/test.html')->getContent()),
);
}

public function getYamlHeader()
{
return implode("\n", ['---', 'extends: _layouts.master', 'section: content', '---', '']);
Expand Down