Skip to content

Commit

Permalink
support rust
Browse files Browse the repository at this point in the history
  • Loading branch information
JSerZANP committed Aug 13, 2023
1 parent 299fa08 commit 6bdb5dd
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
26 changes: 18 additions & 8 deletions examples/web/components/CodeSnippet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const ALL_LANGS = [
// "rst",
"ruby",
// "rb",
// "rust",
"rust",
// "rs",
// "sas",
// "sass",
Expand Down Expand Up @@ -718,13 +718,7 @@ variable <- 123
# ^
# [Hello World!]
`,
ruby: `
# @dim
square = variable * variable
# --------
# ^
# [Hello World!]
`,

python: `
# @dim
def greet(name):
Expand All @@ -733,6 +727,22 @@ def greet(name):
# ^
# [Hello world!]
`,
ruby: `
# @dim
square = variable * variable
# --------
# ^
# [Hello World!]
`,
rust: `
// @dim
fn main() {
let square = variable * variable;
// --------
// ^
// [Hello World!]
}
`,
sql: `
-- Create a new table to store customer information
CREATE TABLE Customers (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```rust annotate
// @dim
fn main() {
let square = variable * variable;
// --------
// ^
// [Hello World!]
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<pre class="shiki github-light" style="color:#24292e;background-color:#fff"><div class="code-container"><code><div class="line dim"><span style="color: #D73A49">fn</span><span style="color: #24292E"> </span><span style="color: #6F42C1">main</span><span style="color: #24292E">() {</span></div><div class="line"><span style="color: #24292E"> </span><span style="color: #D73A49">let</span><span style="color: #24292E"> square </span><span style="color: #D73A49">=</span><span style="color: #24292E"> variable </span><span style="color: #D73A49">*</span><span style="color: #24292E"> variable; </span></div><div class="shaku-underline shaku-underline-solid" style="left:15ch"><span class="shaku-underline-line" style="left:0ch">--------</span></div><div class="shaku-callout" style="left:10ch"><span class="shaku-callout-arrow" style="left:8ch"></span><p>Hello World!</p></div><div class="line"><span style="color: #24292E">}</span></div></code></div></pre>
3 changes: 3 additions & 0 deletions packages/remark-shaku-code-annotate/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,9 @@ const commentMarkers: Record<string, { head?: RegExp; tail?: RegExp }> = {
cobol: {
head: /^\s*\*/,
},
rust: {
head: /^\s*\/\//,
},
};

function trimCommentBody(body: string, lang?: string | null) {
Expand Down

1 comment on commit 6bdb5dd

@vercel
Copy link

@vercel vercel bot commented on 6bdb5dd Aug 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

shaku-web – ./

shaku-web-git-main-jserzanp.vercel.app
shaku-web-jserzanp.vercel.app
shaku-web.vercel.app

Please sign in to comment.