-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add markdoc syntax highlighting
- Loading branch information
Showing
11 changed files
with
247 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License | ||
|
||
Copyright (c) 2021- Stripe, Inc. (https://stripe.com) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
|
||
--- | ||
title: "Markdoc Example File" | ||
description: "A simple example to demonstrate Markdoc's syntax and features." | ||
date: "2025-01-06" | ||
author: "Your Name" | ||
--- | ||
|
||
# Welcome to Markdoc | ||
|
||
Markdoc is a Markdown-based authoring tool that supports custom syntax, making it flexible and extensible. This document demonstrates its core capabilities. | ||
|
||
## Basic Markdown Features | ||
|
||
You can use all standard Markdown syntax, such as: | ||
|
||
### Headings | ||
|
||
```markdown | ||
# Heading 1 | ||
## Heading 2 | ||
### Heading 3 | ||
``` | ||
|
||
### Lists | ||
|
||
- Item 1 | ||
- Sub-item 1 | ||
- Sub-item 2 | ||
- Item 2 | ||
|
||
### Links and Images | ||
|
||
[Visit the official Markdoc website](https://markdoc.io) | ||
|
||
![Example Image](https://via.placeholder.com/150) | ||
|
||
### Inline Styles | ||
|
||
You can include **bold**, *italic*, or `code` inline. | ||
|
||
--- | ||
|
||
## Custom Markdoc Features | ||
|
||
Markdoc allows you to define custom tags and components. Here's an example of a custom tag: | ||
|
||
### Info Box | ||
|
||
{% info %} | ||
This is an example of an **info box** created using a custom tag. | ||
{% /info %} | ||
|
||
### Parameters | ||
|
||
You can pass parameters to custom tags: | ||
|
||
{% callout type="warning" title="Be Careful!" %} | ||
Always validate your inputs! | ||
{% /callout %} | ||
|
||
### Variables | ||
|
||
Use variables to dynamically insert content into your document: | ||
|
||
```markdoc | ||
{% $variable %} | ||
``` | ||
|
||
For example: | ||
|
||
{% $greeting %} | ||
|
||
--- | ||
|
||
## Code Blocks | ||
|
||
```javascript | ||
function greet(name) { | ||
return `Hello, ${name}!`; | ||
} | ||
console.log(greet("World")); | ||
``` | ||
|
||
--- | ||
|
||
## Conclusion | ||
|
||
Markdoc combines the simplicity of Markdown with the power of custom syntax. For more details, check out the [official documentation](https://markdoc.io). |
42 changes: 42 additions & 0 deletions
42
plugin/syntaxes/markdoc/markdoc.language-configuration.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ | ||
"comments": { | ||
"blockComment": [ "<!--", "-->" ] | ||
}, | ||
"brackets": [ | ||
["{", "}"], | ||
["[", "]"], | ||
["(", ")"] | ||
], | ||
"colorizedBracketPairs": [], | ||
"autoClosingPairs": [ | ||
{ | ||
"open": "[", | ||
"close": "]" | ||
}, | ||
{ | ||
"open": "(", | ||
"close": ")" | ||
}, | ||
], | ||
"surroundingPairs": [ | ||
["(", ")"], | ||
["[", "]"], | ||
["`", "`"], | ||
["_", "_"], | ||
["*", "*"], | ||
["{", "}"], | ||
["'", "'"], | ||
["\"", "\""] | ||
], | ||
"folding": { | ||
"offSide": true, | ||
"markers": { | ||
"start": "^\\s*<!--\\s*#?region\\b.*-->", | ||
"end": "^\\s*<!--\\s*#?endregion\\b.*-->" | ||
} | ||
}, | ||
"wordPattern": { | ||
"pattern": "(\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark})(((\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark})|[_])?(\\p{Alphabetic}|\\p{Number}|\\p{Nonspacing_Mark}))*", | ||
"flags": "ug" | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", | ||
"name": "markdoc", | ||
"scopeName": "text.html.markdown.markdoc", | ||
"patterns": [{ "include": "text.html.markdown" }] | ||
} |
36 changes: 36 additions & 0 deletions
36
plugin/syntaxes/markdoc/text.html.markdown.markdoc.injection.tmLanguage.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json", | ||
"scopeName": "text.html.markdown.markdoc.injection", | ||
"injectionSelector": ["L:text.html.markdown", "L:text.html.markdown.markdoc"], | ||
"patterns": [{ "include": "#tag" }], | ||
"repository": { | ||
"shortcut": { | ||
"match": "(\\$|\\.|#)([-_:a-zA-Z0-9]+)", | ||
"name": "string.other.markdoc-shortcut" | ||
}, | ||
"attribute": { | ||
"match": "([-_a-zA-Z0-9]+)(=)", | ||
"captures": { | ||
"1": { "name": "entity.other.attribute-name" }, | ||
"2": { "name": "punctuation.definition.tag.equal.markdoc" } | ||
} | ||
}, | ||
"tag": { | ||
"name": "punctuation.definition.tag", | ||
"begin": "({%)\\s*/?([-_a-zA-Z0-9]+)?", | ||
"end": "\\s*/?\\s*%}", | ||
"beginCaptures": { | ||
"1": { "name": "punctuation.definition.tag.begin.markdoc" }, | ||
"2": { "name": "entity.name.tag" } | ||
}, | ||
"endCaptures": { | ||
"0": { "name": "punctuation.definition.tag.end.markdoc" } | ||
}, | ||
"patterns": [ | ||
{ "include": "#attribute" }, | ||
{ "include": "#shortcut" }, | ||
{ "include": "source.json" } | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters