Implement ProgCode identity and real shared reading UI kit
Build and deploy / deploy (push) Successful in 2m39s

This commit is contained in:
huncode committed 2026-10-27 15:19:49 +03:00
1 parent 99c848189e
commit 12562baeb5
2040 files changed
+184656 -181

No files matched your search

@@ -0,0 +1,9 @@
import sanitizeHtml from 'sanitize-html';
export function cleanPublication(html){return sanitizeHtml(html,{
allowedTags:['p','h2','h3','h4','pre','code','strong','em','b','i','ul','ol','li','blockquote','figure','figcaption','img','table','thead','tbody','tr','th','td','br','a'],
allowedAttributes:{a:['href','title','rel'],img:['src','alt','width','height','loading','decoding'],h2:['id'],h3:['id'],h4:['id'],pre:['tabindex','aria-label']},
allowedSchemes:['https','http'],allowProtocolRelative:false,
transformTags:{a:(tag,attrs)=>({tagName:tag,attribs:{href:attrs.href||'',rel:'noopener noreferrer'}}),pre:(tag,attrs)=>({tagName:tag,attribs:{tabindex:'0','aria-label':'Пример кода, прокрутка клавишами со стрелками'}})},
exclusiveFilter:frame=>frame.tag==='img'&&(!frame.attribs.src?.startsWith('/visuals/')||frame.attribs.src.startsWith('//')),
disallowedTagsMode:'discard',nonTextTags:['script','style','textarea','option','iframe','object','embed','form'],
});}