21 lines
442 B
Raku
21 lines
442 B
Raku
use v6.e.PREVIEW;
|
|
|
|
use Pandoc;
|
|
use JSON::Class:auth<zef:vrurg>;
|
|
use DB::Post;
|
|
|
|
#| A plain markdown post
|
|
unit class MarkdownPost does Post is json(:pretty);
|
|
|
|
#| Marker for disambiguation between post types in json representation, the
|
|
#| cheaty way
|
|
has Bool:D $.markdown = True;
|
|
|
|
method title(--> Str:D) {
|
|
markdown-title $!source
|
|
}
|
|
|
|
# Simply provide our source file to pandoc
|
|
method render-html(--> Str:D) {
|
|
markdown-to-html $!source
|
|
}
|