feat: support link in code block title (#523)

* feat: support link in code block title

* refactor: simplify code block filename link implementation

* docs: update syntax-highlighting.md

* chore: rename `filename_uri_base` to `base_url`

[skip ci]

* refactor: use `base_url` int code block implementation

---------

Co-authored-by: Xin <xin@imfing.com>
This commit is contained in:
strowk
2024-12-28 19:41:23 +07:00
committed by GitHub
parent cf61e606c1
commit 26a298da5d
3 changed files with 38 additions and 5 deletions

View File

@ -40,6 +40,22 @@ def say_hello():
print("Hello!")
```
### Link to File
You can use the `base_url` attribute to provide a base URL that will be combined with the file name to generate a link.
The file name can include a relative path if it specifies the file's location within the base path.
````markdown {filename="Markdown"}
```go {base_url="https://github.com/imfing/hextra/blob/main/",filename="exampleSite/hugo.work"}
go 1.20
```
````
```go {base_url="https://github.com/imfing/hextra/blob/main/",filename="exampleSite/hugo.work"}
go 1.20
```
### Line Numbers
To set line numbers, set attribute `linenos` to `table` and optionally set `linenostart` to the starting line number: