-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
davidwilby
committed
Dec 5, 2023
0 parents
commit 65c50df
Showing
5 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.html | ||
*_files/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# openlinksinnewpage Extension For Quarto | ||
|
||
With the `openlinksinnewpage` filter [hyperlinks](https://quarto.org/) automatically open in a new page, similarly to adding `{target="_blank"}` to your markdown hyperlinks. | ||
|
||
Packaged up as an extension following suggestion by @cscheid on a discussion [here](https://github.com/quarto-dev/quarto-cli/discussions/3169){target="_blank"}. | ||
|
||
This provides an alternative to using the following syntax | ||
|
||
```md | ||
[quarto](https://quarto.org/){target="_blank"} | ||
``` | ||
|
||
if you want all links to be opened in a new page. | ||
|
||
## Installing | ||
|
||
```bash | ||
quarto add davidwilby/openlinksinnewpage | ||
``` | ||
|
||
This will install the extension under the `_extensions` subdirectory. | ||
If you're using version control, you will want to check in this directory. | ||
|
||
## Using | ||
|
||
Carry on as usual! Ensure that the following is in your yaml frontmatter: | ||
|
||
```yaml | ||
filters: | ||
- openlinksinnewpage | ||
``` | ||
All the links in your quarto document or presentation will open in a new page or tab. | ||
## Example | ||
Here is the source code for a minimal example: [example.qmd](example.qmd). | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
title: openlinksinnewpage | ||
author: davidwilby | ||
version: 0.0.1 | ||
quarto-required: ">=1.3.0" | ||
contributes: | ||
filters: | ||
- openlinksinnewpage.lua | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-- As suggested by @cscheid: https://github.com/quarto-dev/quarto-cli/discussions/3169 | ||
|
||
function Link(link) | ||
link.attributes["target"] = "_blank" | ||
return link | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
title: "`openlinksinnewpage` Filter Example" | ||
format: | ||
html: default | ||
pdf: default | ||
filters: | ||
- openlinksinnewpage | ||
--- | ||
|
||
## Heading | ||
|
||
This filter adds formatting to heading text. | ||
|
||
With the `openlinksinnewpage` filter [hyperlinks](https://quarto.org/) automatically open in a new page, similarly to adding `{target="_blank"}` to your markdown hyperlinks. | ||
|