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

Commit d306a52

Browse files
authored
Merge pull request #47 from 8fold/feed-rss
Prepence given markdown
2 parents 6157397 + 0d80776 commit d306a52

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/UIKit/Elements/Compound/Markdown.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ public function extensions(...$extensions)
7272
return $this;
7373
}
7474

75+
public function prepend(string $markdown)
76+
{
77+
$this->markdown = $markdown . $this->markdown;
78+
return $this;
79+
}
80+
7581
public function unfold(): string
7682
{
7783
return Shoop::markdown($this->markdown, ...$this->extensions)

tests/UIKit/MarkdownTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,15 @@ public function testDefaultExtensions($value='')
6767
->extensions(AbbreviationExtension::class);
6868
$this->assertEquals($expected, $actual->unfold());
6969
}
70+
71+
public function testCanPrepend()
72+
{
73+
$doc = <<< EOD
74+
Base
75+
EOD;
76+
$prepend = "# Heading\n\n";
77+
$expected = '<h1>Heading</h1><p>Base</p>';
78+
$actual = UIKit::markdown($doc)->prepend($prepend);
79+
$this->assertSame($expected, $actual->unfold());
80+
}
7081
}

0 commit comments

Comments
 (0)