Close #93,#36 Add music short code.

This commit is contained in:
elkan1788
2025-01-06 13:26:27 +08:00
parent 351d6728d0
commit 088da43913
106 changed files with 119 additions and 4 deletions

View File

@@ -13,6 +13,8 @@ tags:
- 短代码
- 语法
url: "demo/shortcodes.html"
toc: true
music: true
---
虽然 `Markdown` 语法已经非常丰富能够满足我们写文章的绝大部分需求,但是为更好的对文章内容进行更友好的排版,为引设计一套自定义的短语,便于在使用时能够快速引用。
@@ -99,4 +101,53 @@ url: "demo/shortcodes.html"
或者
{{</* bilibili id=BV1Sx411T7QQ */>}}
```
{{< bilibili id=BV1Sx411T7QQ >}}
{{</** bilibili id=BV1Sx411T7QQ **/>}}
## 音乐播放器
基于[APlayer](https://github.com/DIYgod/APlayer)和[MetingJS](https://github.com/metowolf/MetingJS)库实现见面内嵌的响应式音乐播放器自动识别的音乐平台URL包括`netease``tencent``kugou``baidu``xiami` 平台,也可以支持用户自定义的音乐源。其他相关的参数说明如下:
| 参数名 | 默认 | 说明 |
| :----: | :------: | :--- |
| **id** | _必选_ | 音乐 ID即音乐在音乐平台的唯一标识符 |
| **server** | _必选_ | 音乐平台,支持 `netease``tencent``kugou``baidu``xiami` 平台 |
| **type** | _必选_ | 播放类型,目前支持 `song``playlist``album``search``artist` 类型 |
| **auto** | _可选_ | 音乐的地址,仅支持 server 参数中的平台 |
| **theme** | `#448aff` | 播放器的主题色,默认为 `#448aff` |
| **url** | 空 | 自定的音乐源 URL默认为空 |
| **name** | 空 | 音乐名称,默认为空 |
| **artist** | 空 | 音乐作者,默认为空 |
| **cover** | 空 | 音乐封面 URL默认为空 |
| **fixed** | `false` | 固定播放器,默认为 `false` |
| **mini** | `false` | 显示小播放器,默认为 `false` |
| **autoplay** | `false` | 自动播放,默认为 `false` |
| **loop** | `all` | 循环播放,支持`all``one``none`,默认为 `all` |
| **order** | `list` | 播放顺序`list``random`,支持默认为 `list` |
| **volume** | `0.7` | 音量,默认为 `0.7` |
| **mutex** | `true` | 有多个音乐播放时,是否只开启当前播放器,默认为 `true` |
| **list-folded** | `false` | 列表折叠,默认为 `false` |
| **list-max-height** | `340px` | 列表最大高度默认为340px |
### 单曲播放
```markdown
{{</* music theme="#2980b9" server="netease" type="song" id="1868553" mini="true" */>}}
```
{{< music theme="#2980b9" server="netease" type="song" id="1868553" mini="true" >}}
### 列表播放
```markdown
{{</* music server="netease" type="playlist" id="769332917" list-max-height="140" */>}}
```
{{< music server="netease" type="playlist" id="769332917" list-max-height="140px" >}}
### 自定义音乐源
```markdown
{{</* music url="https://ri-sycdn.kuwo.cn/ea345253b94e7ad564e6fb0cdf37fee6/677b6574/resource/n1/87/56/4272600974.mp3" name="天空之城" artist="宫崎骏" cover="http://img4.kuwo.cn/star/starheads/500/27/66/2532818318.jpg" autoplay="true" */>}}
```
{{< music url="https://ri-sycdn.kuwo.cn/ea345253b94e7ad564e6fb0cdf37fee6/677b6574/resource/n1/87/56/4272600974.mp3" name="天空之城" artist="宫崎骏" cover="http://img4.kuwo.cn/star/starheads/500/27/66/2532818318.jpg" autoplay="true" >}}