Skip to content

Commit 5891572

Browse files
committed
refactor(link): move link in new tab from in-line HTML to quarto using {target="_blank"} instead (as that's simpler)
1 parent 9e31f67 commit 5891572

File tree

2 files changed

+23
-31
lines changed

2 files changed

+23
-31
lines changed

pages/inline_html.qmd

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ title: Inline HTML
44

55
Web pages are written in **HTML** (HyperText Markup Language), which uses tags like `<p>`, `<a>`, and `<strong>` to describe how things should look.
66

7-
In a Markdown document, you can sometimes mix in small pieces of HTML.
8-
This is called **inline HTML**: you add a tiny HTML tag inside a sentence, and Quarto keeps it when it turns your page into HTML.
7+
In a Markdown document, you can sometimes mix in small pieces of HTML. This is called **inline HTML**: you add a tiny HTML tag inside a sentence, and Quarto keeps it when it turns your page into HTML.
98

109
**Caveat:** raw HTML is only kept when the output format supports it (for example, HTML pages). Some tags may be dropped or ignored when rendering to PDF or Word.
1110

@@ -61,35 +60,6 @@ Press <kbd>Ctrl</kbd> + <kbd>C</kbd>.
6160

6261
:::
6362

64-
## Custom links
65-
66-
If you want more control over a link (for example, to open it in a new tab), you can write it in HTML instead of plain Markdown.
67-
68-
In the HTML link below:
69-
70-
* `href` is the web address you are linking to.
71-
* The text between `<a>` and `</a>` is what the reader clicks on.
72-
* `target="_blank"` tells the browser to open the link in a new tab.
73-
* `rel="noopener"` is a small security and performance setting that stops the new page from being able to control the original tab.
74-
75-
```markdown
76-
<a href="https://www.exeter.ac.uk" target="_blank" rel="noopener">
77-
Visit the University of Exeter website
78-
</a>
79-
```
80-
81-
<a href="https://www.exeter.ac.uk" target="_blank" rel="noopener">
82-
Visit the University of Exeter website
83-
</a>
84-
85-
::: {.pale-blue}
86-
87-
**Task:** In `html.qmd`:
88-
89-
* [ ] Create a link that opens in a new tab by default.
90-
91-
:::
92-
9363
## Abbreviations
9464

9565
You can explain abbreviations by using the `<abbr>` tag with a `title` attribute.

pages/quarto_features.qmd

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,28 @@ By default, columns share the space equally. You can control their width by addi
306306

307307
:::
308308

309+
## Link that opens in a new tab by default
310+
311+
You'll recall from the [Markdown](markdown.qmd) page that we can create a link using `[text](link)`.
312+
313+
In Quarto, we can amend the link so it opens in a new tab by default by adding `{target="_blank"}` to the end.
314+
315+
For example:
316+
317+
```markdown
318+
[Visit the University of Exeter website](https://www.exeter.ac.uk){target="_blank"}
319+
```
320+
321+
[Visit the University of Exeter website](https://www.exeter.ac.uk){target="_blank"}
322+
323+
::: {.pale-blue}
324+
325+
**Task:** In `quarto_features.qmd`:
326+
327+
* [ ] Create a link that opens in a new tab by default.
328+
329+
:::
330+
309331
## Footnotes {#sec-footnotes}
310332

311333
```markdown

0 commit comments

Comments
 (0)