@markii/html 0.17.0-next.4 → 0.17.0-next.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -2
- package/dist/render.js +14 -29
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,7 @@ export { type ResolveImageSrc } from './image-resolve.js';
|
|
|
3
3
|
export { type ResolveHref } from './href-resolve.js';
|
|
4
4
|
export { escapeHtml } from './escape.js';
|
|
5
5
|
export { exportHtmlDocument, type ExportHtmlDocumentOptions, } from './document.js';
|
|
6
|
-
export {
|
|
7
|
-
export { failurePhrase, failureTitle, failureKindClass, dataStateClassName, } from './failure-presentation.js';
|
|
6
|
+
export { resolveScopedPath, VAULT_NAME_PREFIX, type StorePathResolution, type ValueScope, } from './resolve.js';
|
|
8
7
|
export { stringifyStoredValue } from './value-format.js';
|
|
9
8
|
export { createHtmlRegistry, mergeHtmlRegistries, registryAliases, readRegistryComponent, resolveDirectiveAlias, REGISTRY_ALIASES, type DirectiveAttributes, type HtmlRegistry, type HtmlRegistryEntry, type HtmlComponent, type HtmlRenderContext, type RegistryAlias, type RegistryAliases, type ResolvedDirective, type ValueResolution, } from './registry.js';
|
|
10
9
|
export { resolveLayoutAttributes, LAYOUT_ATTRIBUTE_KEYS, type ResolvedLayoutAttributes, } from './layout.js';
|
package/dist/index.js
CHANGED
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
export { renderMarkToHtml, renderMarkNodeToHtml, renderMarkInlineToHtml, } from './render.js';
|
|
7
7
|
export { escapeHtml } from './escape.js';
|
|
8
8
|
export { exportHtmlDocument, } from './document.js';
|
|
9
|
-
export {
|
|
10
|
-
export { failurePhrase, failureTitle, failureKindClass, dataStateClassName, } from './failure-presentation.js';
|
|
9
|
+
export { resolveScopedPath, VAULT_NAME_PREFIX, } from './resolve.js';
|
|
11
10
|
export { stringifyStoredValue } from './value-format.js';
|
|
12
11
|
export { createHtmlRegistry, mergeHtmlRegistries, registryAliases, readRegistryComponent, resolveDirectiveAlias, REGISTRY_ALIASES, } from './registry.js';
|
|
13
12
|
export { resolveLayoutAttributes, LAYOUT_ATTRIBUTE_KEYS, } from './layout.js';
|
package/dist/render.js
CHANGED
|
@@ -5,7 +5,7 @@ import { resolveLayoutAttributes } from './layout.js';
|
|
|
5
5
|
import { escapeHtml } from './escape.js';
|
|
6
6
|
import { resolveScopedPath } from './resolve.js';
|
|
7
7
|
import { failureKindClass, failureTitle, EMPTY_INLINE_MARKER_CLASS, emptyInlineTitle, codeRendererFailedTitle, formMismatchTitle, INLINE_FALLBACK_SEPARATOR, invalidAttributeValueTitle, NO_ENGINE_VIEW_LABEL, noEngineViewTitle, } from './failure-presentation.js';
|
|
8
|
-
import { createUnavailableComponentLookup, formatValue,
|
|
8
|
+
import { createUnavailableComponentLookup, formatValue, invalidEnumAttribute, reportDiagnostic, INTERACTIVE_ATTRIBUTE, } from '@markii/stdlib';
|
|
9
9
|
import { resolveImageAttribute } from './image-resolve.js';
|
|
10
10
|
import { resolveHrefAttribute } from './href-resolve.js';
|
|
11
11
|
function isMarkRoot(node) {
|
|
@@ -359,28 +359,6 @@ function renderScriptMarker(node) {
|
|
|
359
359
|
return undefined;
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
|
-
/**
|
|
363
|
-
* Whether one of `name`'s `@markii/stdlib` contract attributes with a
|
|
364
|
-
* closed `enum` is present in `attributes` with a value outside that enum.
|
|
365
|
-
* Returns the first offending attribute/value pair found, or `undefined`.
|
|
366
|
-
* Mirrors `@markii/react`'s identical `invalidEnumAttribute`.
|
|
367
|
-
*/
|
|
368
|
-
function invalidEnumAttribute(name, attributes) {
|
|
369
|
-
const contract = getContract(name);
|
|
370
|
-
if (!contract)
|
|
371
|
-
return undefined;
|
|
372
|
-
for (const [attribute, schema] of Object.entries(contract.attributes)) {
|
|
373
|
-
const enumValues = schema.enum;
|
|
374
|
-
if (!enumValues)
|
|
375
|
-
continue;
|
|
376
|
-
const value = attributes[attribute];
|
|
377
|
-
if (value === undefined || value === null || value === '')
|
|
378
|
-
continue;
|
|
379
|
-
if (!enumValues.includes(value))
|
|
380
|
-
return { attribute, value };
|
|
381
|
-
}
|
|
382
|
-
return undefined;
|
|
383
|
-
}
|
|
384
362
|
/** Resolves one directive (registry component, `:value[...]`, or the fallback) given its layout-stripped attributes. Never throws. */
|
|
385
363
|
function renderDirectiveContent(name, kind, attributes, childrenHtml, plainLabel, registry, ctx, scope, layoutClassName, unavailable) {
|
|
386
364
|
if (name === VALUE_DIRECTIVE_NAME) {
|
|
@@ -437,12 +415,19 @@ function renderDirectiveContent(name, kind, attributes, childrenHtml, plainLabel
|
|
|
437
415
|
const tag = inline ? 'span' : 'div';
|
|
438
416
|
rendered = `<${tag} data-mk-notice="" title="${escapeHtml(message)}">${rendered}</${tag}>`;
|
|
439
417
|
}
|
|
440
|
-
//
|
|
441
|
-
//
|
|
442
|
-
//
|
|
443
|
-
//
|
|
444
|
-
//
|
|
445
|
-
if (isRegisteredInline(entry) &&
|
|
418
|
+
// Mirrors `@markii/react`'s identical check in `renderDirectiveContent`:
|
|
419
|
+
// an `inline: true` component with neither content nor attributes still
|
|
420
|
+
// renders exactly as registered, wrapped in the same quiet marker and
|
|
421
|
+
// title, so the two engines produce identical markup for this case. A
|
|
422
|
+
// component given attributes draws from them and is not flagged.
|
|
423
|
+
if (isRegisteredInline(entry) &&
|
|
424
|
+
childrenHtml.trim() === '' &&
|
|
425
|
+
Object.keys(attributes).length === 0) {
|
|
426
|
+
reportDiagnostic(ctx.onDiagnostic, {
|
|
427
|
+
kind: 'empty-inline',
|
|
428
|
+
directive: name,
|
|
429
|
+
message: emptyInlineTitle(name),
|
|
430
|
+
});
|
|
446
431
|
const title = escapeHtml(emptyInlineTitle(name));
|
|
447
432
|
return `<span class="${EMPTY_INLINE_MARKER_CLASS}" title="${title}">${rendered}</span>`;
|
|
448
433
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markii/html",
|
|
3
|
-
"version": "0.17.0-next.
|
|
3
|
+
"version": "0.17.0-next.6",
|
|
4
4
|
"description": "A framework-free static HTML renderer for Markii (.mk.md): a registry-driven hast-to-HTML string engine. Zero React; for stopped-changing documents (publish, CI, email, archive).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"hast-util-to-html": "^9.0.0",
|
|
57
|
-
"@markii/core": "^0.17.0-next.
|
|
58
|
-
"@markii/runtime": "^0.17.0-next.
|
|
59
|
-
"@markii/stdlib": "^0.17.0-next.
|
|
57
|
+
"@markii/core": "^0.17.0-next.6",
|
|
58
|
+
"@markii/runtime": "^0.17.0-next.6",
|
|
59
|
+
"@markii/stdlib": "^0.17.0-next.6"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/hast": "^3.0.4"
|