Files
dealplustech/dealplustech-astro/node_modules/mdast-util-definitions/lib/index.js
Kunthawat Greethong 3ed9f3f3ff 🎨 Fix CSS: Import global.css + plain CSS styles
CSS was not being imported! Fixed:

 Added 'import ../styles/global.css' to BaseLayout.astro
 Rewrote CSS with plain CSS (not @apply which wasn't working)
 Cookie banner has inline styles as backup
 Font size: 16px base
 Solid colors: green-600 (#16a34a), gray-900 (#111827)
 Footer has policy links

Build: 12 pages 
2026-03-10 08:21:30 +07:00

59 lines
1.3 KiB
JavaScript

/**
* @typedef {import('mdast').Definition} Definition
* @typedef {import('mdast').Nodes} Nodes
*/
/**
* @callback GetDefinition
* Get a definition by identifier.
* @param {string | null | undefined} [identifier]
* Identifier of definition (optional).
* @returns {Definition | undefined}
* Definition corresponding to `identifier` or `null`.
*/
import {visit} from 'unist-util-visit'
/**
* Find definitions in `tree`.
*
* Uses CommonMark precedence, which means that earlier definitions are
* preferred over duplicate later definitions.
*
* @param {Nodes} tree
* Tree to check.
* @returns {GetDefinition}
* Getter.
*/
export function definitions(tree) {
/** @type {Map<string, Definition>} */
const cache = new Map()
if (!tree || !tree.type) {
throw new Error('mdast-util-definitions expected node')
}
visit(tree, 'definition', function (definition) {
const id = clean(definition.identifier)
if (id && !cache.get(id)) {
cache.set(id, definition)
}
})
return definition
/** @type {GetDefinition} */
function definition(identifier) {
const id = clean(identifier)
return cache.get(id)
}
}
/**
* @param {string | null | undefined} [value]
* @returns {string}
*/
function clean(value) {
return String(value || '').toUpperCase()
}