Skip to content

Commit 670d27f

Browse files
authored
chore: add deprecation warning for GitHub extension (#11)
1 parent 483aa9e commit 670d27f

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

_extensions/github/github.lua

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
local utils = require(quarto.utils.resolve_path('_modules/utils.lua'):gsub('%.lua$', ''))
2727
local git = require(quarto.utils.resolve_path('_modules/git.lua'):gsub('%.lua$', ''))
2828

29+
--- Flag to track if superseded warning has been shown
30+
--- @type boolean
31+
local superseded_warning_shown = false
32+
2933
--- Flag to track if deprecation warning has been shown
3034
--- @type boolean
3135
local deprecation_warning_shown = false
@@ -70,12 +74,28 @@ local function get_metadata_value(meta, key)
7074
return nil
7175
end
7276

77+
--- Show superseded extension warning once
78+
--- This function displays a warning message informing users that this extension
79+
--- has been superseded by the Git Link extension
80+
local function show_superseded_warning()
81+
if not superseded_warning_shown then
82+
quarto.log.warning(
83+
'The "GitHub" extension has been superseded by the "Git Link" extension. ' ..
84+
'Please update your extension following the instructions at: ' ..
85+
'https://github.com/mcanouil/quarto-gitlink?tab=readme-ov-file#installation'
86+
)
87+
superseded_warning_shown = true
88+
end
89+
end
90+
7391
--- Get repository name from metadata or git remote
7492
--- This function extracts the GitHub repository name either from document metadata
7593
--- or by querying the git remote origin URL
7694
--- @param meta table The document metadata table
7795
--- @return table The metadata table (unchanged)
7896
local function get_repository(meta)
97+
show_superseded_warning()
98+
7999
local meta_github_base_url = get_metadata_value(meta, 'base-url')
80100
local meta_github_repository = get_metadata_value(meta, 'repository-name')
81101

example.qmd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ filters:
1919

2020
`github` is an extension for [Quarto](https://quarto.org) to automatically shortens and converts [GitHub references](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/autolinked-references-and-urls) into links.
2121

22+
:::: {.callout-warning}
23+
This extension has been superseded by the [Git Link extension](https://github.com/mcanouil/quarto-gitlink).
24+
Please update your project to use the new extension.
25+
26+
To install the new extension, see the [installation instructions](https://github.com/mcanouil/quarto-gitlink?tab=readme-ov-file#installation).
27+
:::
28+
2229
## Installation
2330

2431
```bash

0 commit comments

Comments
 (0)