wip; tests passing
This commit is contained in:
+5
-5
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user