mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-10-03 13:53:53 +02:00
Add M3U8 syntax highlighting in docs
This commit is contained in:
@@ -5,6 +5,7 @@ import llmstxt from 'vitepress-plugin-llms';
|
|||||||
import { HeadConfig } from 'vitepress';
|
import { HeadConfig } from 'vitepress';
|
||||||
// @ts-expect-error This file gets generated once docs:generate is run
|
// @ts-expect-error This file gets generated once docs:generate is run
|
||||||
import apiRoutes from '../api/index.json';
|
import apiRoutes from '../api/index.json';
|
||||||
|
import m3u8Grammar from './m3u8-grammar.json' with { type: 'json' };
|
||||||
|
|
||||||
const DESCRIPTION = 'A JavaScript library for reading, writing, and converting media files. Directly in the browser,'
|
const DESCRIPTION = 'A JavaScript library for reading, writing, and converting media files. Directly in the browser,'
|
||||||
+ ' and faster than anybunny else.';
|
+ ' and faster than anybunny else.';
|
||||||
@@ -168,6 +169,9 @@ export default withMermaid({
|
|||||||
markdown: {
|
markdown: {
|
||||||
math: true,
|
math: true,
|
||||||
theme: { light: 'github-light', dark: 'github-dark-dimmed' },
|
theme: { light: 'github-light', dark: 'github-dark-dimmed' },
|
||||||
|
shikiSetup: (shiki) => {
|
||||||
|
shiki.loadLanguageSync(m3u8Grammar);
|
||||||
|
},
|
||||||
config(md) {
|
config(md) {
|
||||||
md.use(footnote);
|
md.use(footnote);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
{
|
||||||
|
"name": "m3u8",
|
||||||
|
"scopeName": "source.m3u8",
|
||||||
|
"fileTypes": ["m3u8"],
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"match": "^#EXTM3U$",
|
||||||
|
"name": "keyword.control.m3u8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"begin": "^(#)(EXTINF)(:)",
|
||||||
|
"beginCaptures": {
|
||||||
|
"1": { "name": "punctuation.definition.comment.m3u8" },
|
||||||
|
"2": { "name": "keyword.control.extinf.m3u8" },
|
||||||
|
"3": { "name": "punctuation.separator.key-value.m3u8" }
|
||||||
|
},
|
||||||
|
"end": "$",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"match": "\\b\\d+(?:\\.\\d+)?\\b",
|
||||||
|
"name": "string.unquoted.m3u8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": ",",
|
||||||
|
"name": "punctuation.separator.sequence.m3u8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "[^,\\n]+",
|
||||||
|
"name": "string.unquoted.title.m3u8"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"begin": "^(#)(EXT-X-[A-Z0-9-]+|EXT-[A-Z0-9-]+)(:)",
|
||||||
|
"beginCaptures": {
|
||||||
|
"1": { "name": "punctuation.definition.comment.m3u8" },
|
||||||
|
"2": { "name": "keyword.control.tag.m3u8" },
|
||||||
|
"3": { "name": "punctuation.separator.key-value.m3u8" }
|
||||||
|
},
|
||||||
|
"end": "$",
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"include": "#attribute-list"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\b(?:YES|NO)\\b",
|
||||||
|
"name": "string.unquoted.m3u8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\b\\d+(?:\\.\\d+)?\\b",
|
||||||
|
"name": "string.unquoted.m3u8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "[^,\\n]+",
|
||||||
|
"name": "string.unquoted.m3u8"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "^[^#\\s][^\\n]*$",
|
||||||
|
"name": "source.m3u8.uri"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "#.*$",
|
||||||
|
"name": "comment.line.number-sign.m3u8"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"attribute-list": {
|
||||||
|
"patterns": [
|
||||||
|
{
|
||||||
|
"match": "\\b[A-Z0-9-]+(?==)",
|
||||||
|
"name": "variable.parameter.m3u8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "=",
|
||||||
|
"name": "keyword.operator.assignment.m3u8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": ",",
|
||||||
|
"name": "punctuation.separator.sequence.m3u8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\"[^\"]*\"",
|
||||||
|
"name": "string.quoted.double.m3u8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\b\\d+x\\d+\\b",
|
||||||
|
"name": "string.unquoted.m3u8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\b\\d+(?:\\.\\d+)?\\b",
|
||||||
|
"name": "string.unquoted.m3u8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\b(?:YES|NO)\\b",
|
||||||
|
"name": "string.unquoted.m3u8"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"match": "\\b[A-Z0-9_-]+\\b",
|
||||||
|
"name": "string.unquoted.m3u8"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user