Skip to content

Interpretation of html base href is wrong when a href begins with slash #2777

Closed
ryandesign opened this Issue · 2 comments

2 participants

@ryandesign

Input HTML file:

<html>
<head>
<base href="http://www.example.com/some/directory/">
</head>
<body>
<p><a href="/absolute/link">absolute link</a></p>
</body>
</html>

Run command:

pandoc -f html -t markdown file.html

Expected output:

[absolute link](http://www.example.com/absolute/link)

Actual output:

[absolute link](http://www.example.com/some/directory//absolute/link)
@jgm jgm added a commit that closed this issue
@jgm Fixed behavior of base tag.
+ If the base path does not end with slash, the last component
  will be replaced.  E.g. base = `http://example.com/foo`
  combines with `bar.html` to give `http://example.com/bar.html`.
+ If the href begins with a slash, the whole path of the base
  is replaced.  E.g. base = `http://example.com/foo/` combines
  with `/bar.html` to give `http://example.com/bar.html`.

Closes #2777.
a485c42
@jgm jgm closed this in a485c42
@ryandesign

Thanks! Do you plan to release a new version of pandoc containing this change soon? Building pandoc from source is difficult.

@jgm
Owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.