const esc=v=>String(v).replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c])); function inline(text){let result='',from=0;for(const m of text.matchAll(/\[([^\]\n]{1,200})\]\((https:\/\/[^\s)]+)\)/g)){result+=esc(text.slice(from,m.index));let url;try{url=new URL(m[2]);}catch{}result+=url?.protocol==='https:'?''+esc(m[1])+'':esc(m[0]);from=m.index+m[0].length;}return result+esc(text.slice(from));} export function renderNewsBody(value){let html='',paragraph=[],list=false;const flush=()=>{if(paragraph.length){html+='
'+inline(paragraph.join(' '))+'
';paragraph=[];}if(list){html+='';list=false;}};for(const raw of String(value).replace(/\r/g,'').split('\n')){const line=raw.trim();if(!line){flush();continue;} const picture=line.match(/^!\[([^\]\n]{1,200})\]\((https:\/\/www\.dunerealms\.com\/assets\/(?:seals\/)?[a-z0-9-]+\.(?:png|webp|jpg))\)$/i); if(picture){flush();const seal=picture[2].includes('/seals/');html+='