wip; tests passing

This commit is contained in:
evilchili
2026-05-15 14:34:20 -07:00
parent 9748d12ede
commit c61b8e2f8b
10 changed files with 110 additions and 585 deletions
+5 -5
View File
@@ -1,9 +1,7 @@
import { ribbit } from './setup';
import { ribbit, resetDOM } from './setup';
const lib = ribbit();
const spacePattern = / /g;
const macros = [
{
name: 'user',
@@ -13,7 +11,7 @@ const macros = [
name: 'npc',
toHTML: ({ keywords }: any) => {
const name = keywords.join(' ');
return '<a href="/NPC/' + name.replace(spacePattern, '') + '">' + name + '</a>';
return '<a href="/NPC/' + name.replace(/ /g, '') + '">' + name + '</a>';
},
},
{
@@ -26,7 +24,9 @@ const macros = [
},
];
const converter = new lib.HopDown({ macros });
const editor = new lib.Editor({macros: macros});
const converter = editor.converter;
const H = (md: string) => converter.toHTML(md);
const M = (html: string) => converter.toMarkdown(html);