Update Create Mod Generators to 1.21.1 (#762)
Some checks failed
Deploy to GitHub Pages / build (push) Has been cancelled
Deploy to GitHub Pages / deploy (push) Has been cancelled

* Initial Create Recipes

* Minor Changes

* Minor Changes

* fix issue with mixing recipe

* fix issue with cutting recipe

* Update to 1.21.1

* add compacting recipe and fix some issues

* Delete .vscode/snippets.json.code-snippets

* Final Touches

* change warning colour

* Sanitize mcdoc doc comments

* Fix until attributes, as they are exclusive

---------

Co-authored-by: Misode <misoloo64@gmail.com>
This commit is contained in:
VidTDM
2025-08-08 01:23:14 +05:30
committed by GitHub
parent ca36fc9c26
commit 07577f28e8
4 changed files with 186 additions and 108 deletions

View File

@@ -9,6 +9,7 @@ import { handleAttributes } from '@spyglassmc/mcdoc/lib/runtime/attribute/index.
import type { SimplifiedEnum, SimplifiedMcdocType, SimplifiedMcdocTypeNoUnion, SimplifiedStructType, SimplifiedStructTypePairField } from '@spyglassmc/mcdoc/lib/runtime/checker/index.js'
import { getValues } from '@spyglassmc/mcdoc/lib/runtime/completer/index.js'
import { Identifier, ItemStack } from 'deepslate'
import DOMPurify from 'dompurify'
import { marked } from 'marked'
import { useCallback, useEffect, useMemo, useState } from 'preact/hooks'
import config from '../../Config.js'
@@ -1185,9 +1186,16 @@ interface KeyProps {
function Key({ label, doc, raw }: KeyProps) {
const [shown, setShown] = useFocus()
const cleanDoc = useMemo(() => {
if (!doc) {
return doc
}
return DOMPurify.sanitize(marked(doc), { FORBID_ATTR: ['style'] })
}, [doc])
return <label onClick={() => setShown(true)}>
<span class={doc ? `underline ${shown ? '' : 'decoration-dotted hover:decoration-solid'}` : ''}>{raw ? label.toString() : formatIdentifier(label.toString())}</span>
{doc && <div class={`node-doc ${shown ? '' : 'hidden'}`} onClick={e => e.stopPropagation()} dangerouslySetInnerHTML={{ __html: marked(doc) }}></div>}
{cleanDoc && <div class={`node-doc ${shown ? '' : 'hidden'}`} onClick={e => e.stopPropagation()} dangerouslySetInnerHTML={{ __html: cleanDoc }}></div>}
</label>
}