@@ -50,13 +50,13 @@ for (const {name, isFile} of Deno.readDirSync(`./blog/content`)) {
5050}
5151
5252for ( const script of JSON . parse ( Deno . readTextFileSync ( scripthubJson ) ) . scripts ) {
53- const { fullname , description, birthtime, avatar } = script
53+ const { cmd , description, birthtime, avatar } = script
5454 const url = `https://mash.pkgx.sh/${ fullname } `
5555 if ( description ) rv . push ( {
56- type : 'script ' ,
56+ type : 'mash ' ,
5757 time : new Date ( birthtime ) ,
58- description : description . split ( ". " ) ?. [ 0 ] ?? description ,
59- title : fullname ,
58+ description : demarkdown ( description . split ( ". " ) ?. [ 0 ] ?? description ) ,
59+ title : cmd ,
6060 image : avatar ,
6161 url
6262 } )
@@ -65,3 +65,11 @@ for (const script of JSON.parse(Deno.readTextFileSync(scripthubJson)).scripts) {
6565rv . sort ( ( a , b ) => b . time . getTime ( ) - a . time . getTime ( ) )
6666
6767console . log ( JSON . stringify ( rv ) )
68+
69+ function demarkdown ( input : string ) {
70+ return input
71+ . replace ( / ` ( [ ^ ` ] + ) ` / g, "<code>$1</code>" )
72+ . replace ( / \* \* ( [ ^ * ] + ) \* \* / g, "<strong>$1</strong>" )
73+ . replace ( / \* ( [ ^ * ] + ) \* / g, "<em>$1</em>" )
74+ . replace ( / ~ ~ ( [ ^ ~ ] + ) ~ ~ / g, "<del>$1</del>" )
75+ }
0 commit comments