This commit is contained in:
2024-10-21 13:27:33 +02:00
parent 0471e05ef3
commit 87792c5089
3 changed files with 45 additions and 0 deletions

19
models/article.ts Normal file
View File

@@ -0,0 +1,19 @@
import { NEvent } from "../nostr.ts";
import { render as renderMarkdown } from "@deno/gfm";
export default class Article {
private event: NEvent;
constructor(event: NEvent) {
this.event = event;
}
get identifier(): string | null {
const tag = this.event.tags.find((t) => t[0] === "d");
return tag ? tag[1] : null;
}
get html(): string {
return renderMarkdown(this.event.content);
}
}