1
0
Fork 0
management/front/dkha-web-sz-main/node_modules/highlight.js/lib/languages/diff.js

86 lines
1.5 KiB
JavaScript
Raw Normal View History

2024-01-16 21:26:16 +08:00
/*
Language: Diff
Description: Unified and context diff
Author: Vasily Polovnyov <vast@whiteants.net>
Website: https://www.gnu.org/software/diffutils/
Category: common
*/
/** @type LanguageFn */
function diff(hljs) {
2023-12-18 13:12:25 +08:00
return {
2024-01-16 21:26:16 +08:00
name: 'Diff',
2023-12-18 13:12:25 +08:00
aliases: ['patch'],
contains: [
{
className: 'meta',
relevance: 10,
variants: [
2024-01-16 21:26:16 +08:00
{
begin: /^@@ +-\d+,\d+ +\+\d+,\d+ +@@/
},
{
begin: /^\*\*\* +\d+,\d+ +\*\*\*\*$/
},
{
begin: /^--- +\d+,\d+ +----$/
}
2023-12-18 13:12:25 +08:00
]
},
{
className: 'comment',
variants: [
2024-01-16 21:26:16 +08:00
{
begin: /Index: /,
end: /$/
},
{
begin: /^index/,
end: /$/
},
{
begin: /={3,}/,
end: /$/
},
{
begin: /^-{3}/,
end: /$/
},
{
begin: /^\*{3} /,
end: /$/
},
{
begin: /^\+{3}/,
end: /$/
},
{
begin: /^\*{15}$/
},
{
begin: /^diff --git/,
end: /$/
}
2023-12-18 13:12:25 +08:00
]
},
{
className: 'addition',
2024-01-16 21:26:16 +08:00
begin: /^\+/,
end: /$/
2023-12-18 13:12:25 +08:00
},
{
className: 'deletion',
2024-01-16 21:26:16 +08:00
begin: /^-/,
end: /$/
2023-12-18 13:12:25 +08:00
},
{
className: 'addition',
2024-01-16 21:26:16 +08:00
begin: /^!/,
end: /$/
2023-12-18 13:12:25 +08:00
}
]
};
2024-01-16 21:26:16 +08:00
}
module.exports = diff;