Revert "Add NeuraPress shim package (#792)" (#793)

This reverts commit 3f082e002e.
This commit is contained in:
cloudneutral 2025-12-14 20:25:32 +08:00 committed by GitHub
parent 3f082e002e
commit 6940d239c7
3 changed files with 1 additions and 64 deletions

@ -0,0 +1 @@
Subproject commit 4ad02ef4b50c4aa19f82549ca4e408422043bd8b

View File

@ -1,8 +0,0 @@
{
"name": "@internal/neurapress",
"version": "0.0.0",
"private": true,
"main": "src/index.ts",
"license": "MIT",
"description": "Lightweight NeuraPress shims for the dashboard Markdown studio."
}

View File

@ -1,56 +0,0 @@
import { marked } from 'marked'
const tagBlacklist = [
'script',
'iframe',
'object',
'embed',
'style',
]
function stripUnsafe(html: string): string {
const withoutBlockedTags = tagBlacklist.reduce((current, tag) => {
const pattern = new RegExp(`<${tag}[^>]*>[\s\S]*?<\/${tag}>`, 'gi')
return current.replace(pattern, '')
}, html)
return withoutBlockedTags
.replace(/on[a-z]+="[^"]*"/gi, '')
.replace(/on[a-z]+='[^']*'/gi, '')
.replace(/javascript:/gi, '')
}
export function renderMarkdown(markdown: string): string {
const html = marked.parse(markdown, { gfm: true, breaks: true })
if (typeof html !== 'string') {
return ''
}
return stripUnsafe(html)
}
export const neurapressSample = `## 快速上手 / Quick start
- 使**稿**
- Markdown
-
###
\`\`\`ts
function greet(name: string) {
return \`Hello, ${'${'}name${'}'}!\`
}
console.log(greet('NeuraPress'))
\`\`\`
### / Quotes
> 使 Markdown
> Keep drafts clear and readable with live preview.
### / Links
- [NeuraPress upstream](https://github.com/tianyaxiang/neurapress)
- [XControl Dashboard](/dashboard)
`