Skip to content

Insert html and receive back html with all relative urls resolved to an absolute url.

Notifications You must be signed in to change notification settings

tommedema/html-absolutely

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

html-absolutely

Insert html and receive back html with all relative urls resolved to an absolute url. Works with src and href attributes in html elements and with url attributes inside inline style attributes and style tags.

Table of Contents

absolutely

Insert html and receive back html with all relative urls resolved to an absolute url. Ignores empty urls (e.g. href="").

Parameters

  • html string the HTML to parse for stylesheets
  • resolveTo string to which root url discovered urls should be resolved.

Examples

const absolutely = require('html-absolutely')
const { html } = absolutely(html, { resolveTo: 'https://www.example.com' })
console.log(html)

Returns string html - the html with absolute urls

About

Insert html and receive back html with all relative urls resolved to an absolute url.

Resources

Stars

Watchers

Forks

Packages

No packages published