Markdown subsyntax highlighting.

This commit is contained in:
Adam Harrison 2021-09-16 17:29:44 -04:00
parent 66bfff2e26
commit 4b828eff65
1 changed files with 32 additions and 13 deletions

View File

@ -1,22 +1,41 @@
-- mod-version:2 -- lite-xl 2.0 -- mod-version:2 -- lite-xl 2.0
local syntax = require "core.syntax" local syntax = require "core.syntax"
syntax.add { syntax.add {
files = { "%.md$", "%.markdown$" }, files = { "%.md$", "%.markdown$" },
patterns = { patterns = {
{ pattern = "\\.", type = "normal" }, { pattern = "\\.", type = "normal" },
{ pattern = { "<!%-%-", "%-%->" }, type = "comment" }, { pattern = { "<!%-%-", "%-%->" }, type = "comment" },
{ pattern = { "```", "```" }, type = "string" }, { pattern = { "```c", "```" }, type = "string", syntax = ".c" },
{ pattern = { "``", "``", "\\" }, type = "string" }, { pattern = { "```c++", "```" }, type = "string", syntax = ".cpp" },
{ pattern = { "`", "`", "\\" }, type = "string" }, { pattern = { "```python", "```" }, type = "string", syntax = ".py" },
{ pattern = { "~~", "~~", "\\" }, type = "keyword2" }, { pattern = { "```ruby", "```" }, type = "string", syntax = ".rb" },
{ pattern = "%-%-%-+", type = "comment" }, { pattern = { "```perl", "```" }, type = "string", syntax = ".pl" },
{ pattern = "%*%s+", type = "operator" }, { pattern = { "```php", "```" }, type = "string", syntax = ".php" },
{ pattern = { "%*", "[%*\n]", "\\" }, type = "operator" }, { pattern = { "```javascript", "```" }, type = "string", syntax = ".js" },,
{ pattern = { "%_", "[%_\n]", "\\" }, type = "keyword2" }, { pattern = { "```html", "```" }, type = "string", syntax = ".html" },
{ pattern = "#.-\n", type = "keyword" }, { pattern = { "```xml", "```" }, type = "string", syntax = ".xml" },
{ pattern = "!?%[.-%]%(.-%)", type = "function" }, { pattern = { "```css", "```" }, type = "string", syntax = ".css" },
{ pattern = "https?://%S+", type = "function" }, { pattern = { "```lua", "```" }, type = "string", syntax = ".lua" },
{ pattern = { "```bash", "```" }, type = "string", syntax = ".sh" },
{ pattern = { "```java", "```" }, type = "string", syntax = ".java" },
{ pattern = { "```c#", "```" }, type = "string", syntax = ".cs" },
{ pattern = { "```cmake", "```" }, type = "string", syntax = ".cmake" },
{ pattern = { "```d", "```" }, type = "string", syntax = ".d" },
{ pattern = { "```glsl", "```" }, type = "string", syntax = ".glsl" },
{ pattern = { "```", "```" }, type = "string" },
{ pattern = { "``", "``", "\\" }, type = "string" },
{ pattern = { "`", "`", "\\" }, type = "string" },
{ pattern = { "~~", "~~", "\\" }, type = "keyword2" },
{ pattern = "%-%-%-+", type = "comment" },
{ pattern = "%*%s+", type = "operator" },
{ pattern = { "%*", "[%*\n]", "\\" }, type = "operator" },
{ pattern = { "%_", "[%_\n]", "\\" }, type = "keyword2" },
{ pattern = "#.-\n", type = "keyword" },
{ pattern = "!?%[.-%]%(.-%)", type = "function" },
{ pattern = "https?://%S+", type = "function" },
}, },
symbols = { }, symbols = { },
} }