<script type="module"> import {encode} from 'https://esm.sh/micromark-util-encode@1?bundle'</script>
Use
import {encode} from 'micromark-util-encode'encode('<3') // '<3'
API
This module exports the identifier encode.
There is no default export.
encode(value)
Encode only the dangerous HTML characters.
This ensures that certain characters which have special meaning in HTML are
dealt with.
Technically, we can skip > and " in many cases, but CM includes them.
Parameters
value (string)
— value to encode
Returns
Encoded value (string).
Types
This package is fully typed with TypeScript.
It exports no additional types.
Compatibility
Projects maintained by the unified collective are compatible with maintained
versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line,
micromark-util-encode@2, compatible with Node.js 16.
This package works with micromark@3.