Skip to content

Commit

Permalink
Added markdown host language, unified TS and JS, added JSX and TSX
Browse files Browse the repository at this point in the history
  • Loading branch information
ruschaaf committed May 19, 2024
1 parent 986c950 commit c128e89
Show file tree
Hide file tree
Showing 43 changed files with 6,653 additions and 169 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ the string as well:
![cpp_example.png](images/cpp_example.png)

---
## Host language - Javascript and TypeScript
## Host language - Javascript, TypeScript, JSX and TSX

Javascript and TypeScript template strings delimited by backticks
(e.g. `` `...text...` ``) can be multiline. This extension supports
Expand Down Expand Up @@ -174,6 +174,7 @@ signal which language you are using.
| LaTeX | latex | `%latex` |
| Lua | lua | `--lua` |
| Makefile | makefile, make | `#make`, `#makefile`, `#!/usr/bin/make` |
| Markdown | markdown, md | `<!--md` |
| Metal shading language | metal | `//metal` |
| Python | py, python | `#py` |
| Powershell | powershell, ps1 | `#powershell` |
Expand Down
19 changes: 19 additions & 0 deletions examples/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,25 @@ function Add-Numbers ($num1, $num2) {
)ps1";


//////////////////////////////////////////////////////////////////////
// Markdown Example
static const char* md_string = R"md(
# Markdown example
This is a (paragraph)[http://example.com] of text in **bold** and *italic*.
## Heading 2
- Item 1
- Item 2
- Item 3
> This is a blockquote.
)md";




//////////////////////////////////////////////////////////////////////
Expand Down
17 changes: 17 additions & 0 deletions examples/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,23 @@ function Add-Numbers ($num1, $num2) {
return $sum
}
`;

// Markdown Example
md_string := /*md*/ `
# Markdown example
This is a (paragraph)[http://example.com] of text in **bold** and *italic*.
## Heading 2
- Item 1
- Item 2
- Item 3
> This is a blockquote.
`;

}
24 changes: 20 additions & 4 deletions examples/example.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import foo from 'bar'

// These strings all contain example embedded languages using the
// javascript template string syntax
// These strings all contain example embedded languages using the
// typescript template string syntax

//////////////////////////////////////////////////////////////////////
// Documentation Examples:
Expand All @@ -15,7 +15,7 @@ SELECT user_name FROM users WHERE id = 1234

// ` and $ need to be escaped within template strings
const s2 = /*py*/ `
print(f" \`hello world', from \${__name__}");
print(f" \`hello world', from \${__name__}");
`;

// Tagged template, requires a sql() function
Expand Down Expand Up @@ -424,5 +424,21 @@ function Add-Numbers (\$num1, \$num2) {
`;


// Markdown Example
const md_string = /*md*/ `
# Markdown example
This is a (paragraph)[http://example.com] of text in **bold** and *italic*.
## Heading 2
- Item 1
- Item 2
- Item 3
> This is a blockquote.
`;



Loading

0 comments on commit c128e89

Please sign in to comment.