@@ -28,7 +28,7 @@ import {
2828 mention as mentionPlugin ,
2929 toFullHandle ,
3030} from "@fedify/markdown-it-mention" ;
31- import { escape } from "@std/ html/ entities" ;
31+ import { encode } from "html- entities" ;
3232import MarkdownIt from "markdown-it" ;
3333import type { DeferredCustomEmoji } from "./emoji.ts" ;
3434import type { Session } from "./session.ts" ;
@@ -153,7 +153,7 @@ export class TemplatedText<TContextData>
153153 paraState = "opened" ;
154154 }
155155 if ( l > 0 ) yield "<br>" ;
156- yield escape ( line ) ;
156+ yield encode ( line ) ;
157157 l ++ ;
158158 }
159159 p ++ ;
@@ -241,7 +241,7 @@ export class PlainText<TContextData> implements Text<"inline", TContextData> {
241241 let first = true ;
242242 for ( const line of this . text . split ( "\n" ) ) {
243243 if ( ! first ) yield "<br>" ;
244- yield escape ( line ) ;
244+ yield encode ( line ) ;
245245 first = false ;
246246 }
247247 }
@@ -325,18 +325,18 @@ export class MentionText<TContextData> implements Text<"inline", TContextData> {
325325 ? actor . url . href
326326 : actor . url ;
327327 if ( url == null ) {
328- yield escape ( label ) ;
328+ yield encode ( label ) ;
329329 return ;
330330 }
331331 yield '<a href="' ;
332- yield escape ( url . href ) ;
332+ yield encode ( url . href ) ;
333333 yield '" translate="no" class="h-card u-url mention" target="_blank">' ;
334334 if ( label . startsWith ( "@" ) ) {
335335 yield "@<span>" ;
336- yield escape ( label . substring ( 1 ) ) ;
336+ yield encode ( label . substring ( 1 ) ) ;
337337 yield "</span>" ;
338338 } else {
339- yield escape ( label ) ;
339+ yield encode ( label ) ;
340340 }
341341 yield "</a>" ;
342342 }
@@ -472,9 +472,9 @@ export class HashtagText<TContextData> implements Text<"inline", TContextData> {
472472
473473 async * getHtml ( session : Session < TContextData > ) : AsyncIterable < string > {
474474 yield '<a href="' ;
475- yield escape ( session . context . origin ) ;
475+ yield encode ( session . context . origin ) ;
476476 yield "/tags/" ;
477- yield escape ( encodeURIComponent ( this . #tag. toLowerCase ( ) ) ) ;
477+ yield encode ( encodeURIComponent ( this . #tag. toLowerCase ( ) ) ) ;
478478 yield '" class="mention hashtag" rel="tag" target="_blank">#<span>' ;
479479 yield this . #tag;
480480 yield "</span></a>" ;
@@ -620,7 +620,7 @@ export class LinkText<TContextData> implements Text<"inline", TContextData> {
620620
621621 async * getHtml ( session : Session < TContextData > ) : AsyncIterable < string > {
622622 yield '<a href="' ;
623- yield escape ( this . #href. href ) ;
623+ yield encode ( this . #href. href ) ;
624624 yield '" target="_blank">' ;
625625 yield * this . #label. getHtml ( session ) ;
626626 yield "</a>" ;
@@ -749,7 +749,7 @@ export class CustomEmojiText<TContextData>
749749 const emoji = this . getEmoji ( session ) ;
750750 if ( emoji . name == null ) return ;
751751 yield "\u200b" ; // zero-width space for segmentation
752- yield escape ( emoji . name . toString ( ) ) ;
752+ yield encode ( emoji . name . toString ( ) ) ;
753753 yield "\u200b" ;
754754 }
755755
0 commit comments