Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"program": "${workspaceFolder}/target/debug/edit",
"cwd": "${workspaceFolder}",
"args": [
"${workspaceFolder}/crates/edit/src/bin/edit/main.rs"
"${workspaceFolder}/assets/highlighting-tests/markdown.md"
],
},
{
Expand All @@ -23,7 +23,7 @@
"program": "${workspaceFolder}/target/debug/edit",
"cwd": "${workspaceFolder}",
"args": [
"${workspaceFolder}/crates/edit/src/bin/edit/main.rs"
"${workspaceFolder}/assets/highlighting-tests/markdown.md"
],
},
{
Expand All @@ -40,7 +40,7 @@
"program": "${workspaceFolder}/target/debug/edit",
"cwd": "${workspaceFolder}",
"args": [
"${workspaceFolder}/crates/edit/src/bin/edit/main.rs"
"${workspaceFolder}/assets/highlighting-tests/markdown.md"
],
},
{
Expand Down
49 changes: 49 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 71 additions & 0 deletions assets/highlighting-tests/bash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/usr/bin/env bash

# This is a comment

readonly VAR1="Hello" # String literal
VAR2=42 # Integer literal
VAR3=$((VAR2 + 8)) # Arithmetic expansion
VAR4=$(echo "World") # Command substitution

function greet() { # Function definition
local name="$1" # Local variable, parameter expansion
echo "${VAR1}, $name! $VAR4" # String, parameter expansion, variable
}

greet "User" # Function call, string literal

if [[ $VAR2 -gt 40 && $VAR3 -eq 50 ]]; then # Conditional, test, operators
echo "Numbers are correct" # String literal
elif (( VAR2 < 40 )); then # Arithmetic test
echo 'VAR2 is less than 40' # Single-quoted string
else
echo "Other case"
fi

for i in {1..3}; do # Brace expansion, for loop
echo "Loop $i" # String, variable
done

case "$VAR4" in # Case statement
World) echo "It's World";; # Pattern, string
*) echo "Unknown";; # Wildcard
esac

arr=(one two three) # Array
echo "${arr[1]}" # Array access

declare -A assoc # Associative array
assoc[key]="value"
echo "${assoc[key]}"

# Here document
cat <<EOF
Multi-line
string with $VAR1
EOF

# Here string
grep H <<< "$VAR1"

# Subshell
(subshell_var=99; echo $subshell_var)

# Redirection
echo "Redirected" > /dev/null

# Background job
sleep 1 &

# Arithmetic assignment
let VAR2+=1

# Process substitution
diff <(echo foo) <(echo bar)

# Command grouping
{ echo "Group 1"; echo "Group 2"; }

# Escaped characters
echo "A quote: \" and a backslash: \\"

# End of file
41 changes: 41 additions & 0 deletions assets/highlighting-tests/batch.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@echo off
REM --- String, Variable, Label, Command, Operator, Number, Delimiter, Comment ---

:: Label
:Start

:: Variable assignment and usage
set "VAR1=Hello"
set VAR2=World

:: String with spaces and special characters
set "STR=Batch ^& CMD!"

:: Arithmetic operation (number, operator)
set /a SUM=5+10

:: IF statement (keyword, operator, string, variable)
if "%VAR1%"=="Hello" (
echo %VAR1%, %VAR2%! %STR%
) else (
echo Not matched!
)

:: FOR loop (keyword, variable, delimiter, string)
for %%F in (*.bat) do (
echo Found file: %%F
)

:: CALL command (keyword, label)
call :SubRoutine

:: GOTO command (keyword, label)
goto :End

:: Subroutine with parameter
:SubRoutine
echo In subroutine with SUM=%SUM%
goto :eof

:End
REM End of script
51 changes: 51 additions & 0 deletions assets/highlighting-tests/html.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Syntax Test &amp; Demo</title>
<!-- Comment with special chars: <>&"' -->
<style>
body {
margin: 0;
padding: 20px;
}

.test {
color: #ff0000;
}
</style>
</head>

<body>
<h1 id="main" class='header' data-value="123">Heading</h1>

<!-- Various elements -->
<p>Text with &lt; &gt; &amp; &quot; &apos; &#65; &#x41; entities</p>
<br />
<hr>
<img src="image.png" alt="Description" />

<!-- Attributes -->
<input type="text" disabled required value="" data-custom="attr">
<button onclick="test()">Click</button>

<!-- Nested elements -->
<div>
<span>Inline <strong>bold</strong> text</span>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
</div>

<!-- Script -->
<script>
function test() {
return x < 10 && y > 5;
}
</script>
</body>

</html>
75 changes: 75 additions & 0 deletions assets/highlighting-tests/markdown.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# H1

## H2

### H3

#### H4

##### H5

###### H6

regular
*italic*
_italic_
**bold**
__bold__
***bold italic***
**_bold italic_**
__*bold italic*__
~~strikethrough~~
`inline code`
`` `literal` ``
\*not\* \_italic\_ # not a heading

* Unordered item
- Nested item
* Third level
* Task list:
* [ ] To do
* [x] Done
* [ ] *Mixed* **formatting** with `code`
1. Ordered can start anywhere
2. …like here (intentional)
1. Nested ordered
2. Multiple paragraphs within a list item:
Still the same item.

> A single-level quote
>
> > A nested quote with **bold** and `code`
>
> * List in a quote
> * [Link in quote](#links)

Inline: [Example](https://example.com "Example Title")
Reference: [Ref Link][ref] and [Another][another-ref]
Relative: [This section](#tables)
Footnote: [^note]
[ref]: https://example.com
[another-ref]: https://github.com
[^note]: This is a footnote with **formatting** and a [link](https://github.com).

Inline: ![Alt text](https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png "GitHub Mark")
Reference: ![Logo][logo-ref]
[logo-ref]: https://github.githubassets.com/images/modules/logos_page/GitHub-Logo.png "GitHub Logo"

| Left | Center | Right |
| :---------- | :--------: | ----: |
| *italic* | `code` | 123 |
| **bold** | ~~strike~~ | 4.56 |
| [link][ref] | :tada: | `end` |

```bash
# Shell
echo "Hello, world" | tr a-z A-Z
```

```json
{
"name": "gfm-kitchen-sink",
"private": true,
"scripts": { "test": "echo ok" }
}
```
Loading
Loading