-
-
Notifications
You must be signed in to change notification settings - Fork 31
Closed
Description
Hi and thanks for a great lib!
Given an html document like this:
<!doctype html>
<html>
<head>
<base href="/pages/">
</head>
<body>
<a href="page2.html">Hi</a>
</body>
</html>
The actual location for page2.html
is /pages/page2.html
because there is a <base>
element which sets the base url for all relative urls.
But when I compile it to markdown with Breakdance it yields:
[Hi](page2.html)
When it should instead be:
[Hi](/pages/page2.html)
I had a hard time tracking down the domain
option to the breakdance-util
package, and because it depends on state and options from the compiler I haven't figured out a good way to solve it.
My quick fix is to use cheerio
myself like this:
const $ = cheerio.load('...the html above...');
breakdance($.html(), {domain: url.resolve(myUrl, $('base').first().attr('href'))})
This works but it would be better if Breakdance did support the <base>
element, which I think it should.
What do you think?
Metadata
Metadata
Assignees
Labels
No labels