mirror of
https://github.com/welpo/tabi.git
synced 2025-10-11 07:46:15 +02:00
✨ feat(remote_text shortcode): support line ranges (#399)
This commit is contained in:
parent
90c1da1ddb
commit
008b976e06
4 changed files with 59 additions and 1 deletions
|
@ -207,6 +207,14 @@ dist/
|
|||
|
||||
Embed text from a remote URL or a local file. To display the path or URL on the code block, see the [show source or path shortcode](#show-source-or-path).
|
||||
|
||||
The shortcode accepts three parameters:
|
||||
|
||||
- `src`: The source URL or file path (required)
|
||||
- `start`: First line to display (optional, starts at 1)
|
||||
- `end`: The ending line number (optional, defaults to 0, meaning the last line)
|
||||
|
||||
{{ admonition(type="info", text="`start` and `end` are inclusive. `start=3, end=3` will display only the third line.") }}
|
||||
|
||||
**Important**:
|
||||
|
||||
- **Remote VS local files**: If `src` starts with "http", it will be treated as a remote file. Otherwise, it assumes a local file path.
|
||||
|
@ -229,6 +237,12 @@ Displaying text from a local file:
|
|||
{{/* remote_text(src="path/to/file.txt") */}}
|
||||
```
|
||||
|
||||
Display lines 3 to 7 (both inclusive) of a local file:
|
||||
|
||||
```
|
||||
{{/* remote_text(src="path/to/file.txt", start=3, end=7) */}}
|
||||
```
|
||||
|
||||
### Admonitions
|
||||
|
||||
Bring attention to information with these admonition shortcodes. They come in five `type`s: `note`, `tip`, `info`, `warning`, and `danger`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue