remixml-pathencode

Lossy encode to URI component

Usage no npm install needed!

<script type="module">
  import remixmlPathencode from 'https://cdn.skypack.dev/remixml-pathencode';
</script>

README

Remixml path-component filter

NPM version Downloads Rate on Openbase

Performs a lossy transformation into a format that can be inserted into a URI path component.

Automatically registers itself as a Remixml filter using the name path.

Basic usage

<set var="_.foo">SÖme text with a diacritic.</set>
Then insert /this/is/a/sanitised/&_.foo:path;/path using the path filter.

Requirements

It runs inside any webbrowser or NodeJS environment.

Reference documentation

  • RemixmlPathencode.encode(string)
    Performs a lossy transformation of string into a format that can be inserted into a URI path component:
    • Cast to lowercase.
    • Replace diacritics by their ASCII equivalent.
    • Replace all strings of non-alphanumeric characters with single dashes.
    • Strip dashes from start and end.

References

Card-carrying member of the zerodeps movement.