Skip to content

Commit dd040a4

Browse files
authored
Fix {#link to=...} example (#40)
* Swap `"` quotes for `|` quotes (`"` is a syntax error) * Make example interactive * Use extant example.com URL * Amend rendering logic to match example
1 parent 5e869d9 commit dd040a4

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

docs/quick-start.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,14 @@ separated by an equal sign `=`. Options are separated by spaces. Options can be
256256
used to modify the behaviour of markup tags, for example changing the target of
257257
a link.
258258

259+
<mf2-interactive>
260+
259261
```mf2
260-
This is a {#link to="home"}link{/link}.
262+
This is a {#link to=|https://example.com|}link{/link}.
261263
```
262264

265+
</mf2-interactive>
266+
263267
It is best practice to not mix styles into messages too much - instead, use
264268
markup tags to add semantic meaning and selectors to text, and let the
265269
application decide how to render the message. This makes it easier to change the

playground.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ export default function IndexPage({ comp }: any) {
258258
<code>link</code>
259259
</td>
260260
<td class="border px-2">
261-
Add a link, pointing to the <code>url</code> option.
261+
Add a link, pointing to the <code>to</code> option.
262262
</td>
263263
</tr>
264264
<tr>

src/_utils/message_format.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function formatMessageToHTML(
5151
}
5252
case "link": {
5353
const link = document.createElement("a");
54-
link.href = part.options?.url as string;
54+
link.href = part.options?.to as string;
5555
link.target = "_blank";
5656
link.rel = "noopener noreferrer";
5757
currentElement.appendChild(link);

0 commit comments

Comments
 (0)