Home / Function/ unescapeHTML() — astro Function Reference

unescapeHTML() — astro Function Reference

Architecture documentation for the unescapeHTML() function in escape.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  a9777e18_d6c8_dd25_9401_be2009f3888d["unescapeHTML()"]
  f9efe560_33a4_eae8_4bc6_06db77690a17["escape.ts"]
  a9777e18_d6c8_dd25_9401_be2009f3888d -->|defined in| f9efe560_33a4_eae8_4bc6_06db77690a17
  bfd09420_df66_2fb3_5a0b_487fb4ef4cc0["unescapeChunksAsync()"]
  bfd09420_df66_2fb3_5a0b_487fb4ef4cc0 -->|calls| a9777e18_d6c8_dd25_9401_be2009f3888d
  55c4ff14_eaef_6922_bdd5_3c9c521a77c1["unescapeChunks()"]
  55c4ff14_eaef_6922_bdd5_3c9c521a77c1 -->|calls| a9777e18_d6c8_dd25_9401_be2009f3888d
  9d13c545_8620_291e_1b7a_2aa233c9e0b2["markHTMLBytes()"]
  a9777e18_d6c8_dd25_9401_be2009f3888d -->|calls| 9d13c545_8620_291e_1b7a_2aa233c9e0b2
  bfd09420_df66_2fb3_5a0b_487fb4ef4cc0["unescapeChunksAsync()"]
  a9777e18_d6c8_dd25_9401_be2009f3888d -->|calls| bfd09420_df66_2fb3_5a0b_487fb4ef4cc0
  55c4ff14_eaef_6922_bdd5_3c9c521a77c1["unescapeChunks()"]
  a9777e18_d6c8_dd25_9401_be2009f3888d -->|calls| 55c4ff14_eaef_6922_bdd5_3c9c521a77c1
  a6fc8e0f_3374_63a9_2337_91a1ed9a894d["hasGetReader()"]
  a9777e18_d6c8_dd25_9401_be2009f3888d -->|calls| a6fc8e0f_3374_63a9_2337_91a1ed9a894d
  d09de695_fffc_1972_558d_93a415cbfd1b["markHTMLString()"]
  a9777e18_d6c8_dd25_9401_be2009f3888d -->|calls| d09de695_fffc_1972_558d_93a415cbfd1b
  style a9777e18_d6c8_dd25_9401_be2009f3888d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/runtime/server/escape.ts lines 84–113

export function unescapeHTML(
	str: any,
):
	| BlessedType
	| Promise<BlessedType | AsyncGenerator<BlessedType, void, unknown>>
	| AsyncGenerator<BlessedType, void, unknown> {
	if (!!str && typeof str === 'object') {
		if (str instanceof Uint8Array) {
			return markHTMLBytes(str);
		}
		// If a response, stream out the chunks
		else if (str instanceof Response && str.body) {
			const body = str.body;
			return unescapeChunksAsync(body);
		}
		// If a promise, await the result and mark that.
		else if (typeof str.then === 'function') {
			return Promise.resolve(str).then((value) => {
				return unescapeHTML(value);
			});
		} else if (str[Symbol.for('astro:slot-string')]) {
			return str;
		} else if (Symbol.iterator in str) {
			return unescapeChunks(str);
		} else if (Symbol.asyncIterator in str || hasGetReader(str)) {
			return unescapeChunksAsync(str);
		}
	}
	return markHTMLString(str);
}

Domain

Subdomains

Frequently Asked Questions

What does unescapeHTML() do?
unescapeHTML() is a function in the astro codebase, defined in packages/astro/src/runtime/server/escape.ts.
Where is unescapeHTML() defined?
unescapeHTML() is defined in packages/astro/src/runtime/server/escape.ts at line 84.
What does unescapeHTML() call?
unescapeHTML() calls 5 function(s): hasGetReader, markHTMLBytes, markHTMLString, unescapeChunks, unescapeChunksAsync.
What calls unescapeHTML()?
unescapeHTML() is called by 2 function(s): unescapeChunks, unescapeChunksAsync.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free