Skip to content

Commit 5eb18fd

Browse files
authored
Merge pull request #105 from indieweb/aaronpk-patch-1
better example of relative URL resolving
2 parents f562a33 + e53b991 commit 5eb18fd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,19 @@ Note that, whilst the property prefixes are stripped, the prefix of the `h-*` cl
113113

114114
### Parsing a document with relative URLs
115115

116-
Most of the time you’ll be getting your input HTML from a URL. You should pass that URL as the second parameter to `Mf2\parse()` so that any relative URLs in the document can be resolved. For example, say you got the following HTML from `http://example.org`:
116+
Most of the time you’ll be getting your input HTML from a URL. You should pass that URL as the second parameter to `Mf2\parse()` so that any relative URLs in the document can be resolved. For example, say you got the following HTML from `http://example.org/post/1`:
117117

118118
```html
119119
<div class="h-card">
120120
<h1 class="p-name">Mr. Example</h1>
121-
<img class="u-photo" alt="" src="photo.png" />
121+
<img class="u-photo" alt="" src="/photo.png" />
122122
</div>
123123
```
124124

125125
Parsing like this:
126126

127127
```php
128-
$output = Mf2\parse($html, 'http://example.org');
128+
$output = Mf2\parse($html, 'http://example.org/post/1');
129129
```
130130

131131
will result in the following output, with relative URLs made absolute:

0 commit comments

Comments
 (0)