Skip to content

Commit

Permalink
support cobol and matlab
Browse files Browse the repository at this point in the history
  • Loading branch information
JSerZANP committed Aug 13, 2023
1 parent f3f5582 commit a5f2248
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 2 deletions.
21 changes: 19 additions & 2 deletions examples/web/components/CodeSnippet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const ALL_LANGS = [
// "clojure",
// "clj",
// "cmake",
// "cobol",
"cobol",
// "codeql",
// "ql",
// "coffee",
Expand Down Expand Up @@ -120,7 +120,7 @@ const ALL_LANGS = [
// "markdown",
// "md",
// "marko",
// "matlab",
"matlab",
// "mdx",
// "mermaid",
// "nginx",
Expand Down Expand Up @@ -604,6 +604,14 @@ int main() {
// [Hello World!]
return 0;
}
`,
cobol: `
* @dim
ENVIRONMENT DIVISION.
DATA DIVISION.
* --------
* ^
* [Hello World!]
`,
cpp: `
// @dim
Expand Down Expand Up @@ -683,6 +691,15 @@ export default function Counter() {
</button>
);
}`,
matlab: `
% @dim
% This is a single-line comment in MATLAB.
variable = 10;
% --
% ^
% [Hello World!]
`,
php: `
// @dim
<?php
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
```cobol annotate
* @dim
ENVIRONMENT DIVISION.
DATA DIVISION.
* --------
* ^
* [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">ENVIRONMENT DIVISION</span><span style="color: #24292E">.</span></div><div class="line"><span style="color: #D73A49">DATA DIVISION</span><span style="color: #24292E">.</span></div><div class="shaku-underline shaku-underline-solid" style="left:5ch"><span class="shaku-underline-line" style="left:0ch">--------</span></div><div class="shaku-callout" style="left:2ch"><span class="shaku-callout-arrow" style="left:2ch"></span><p>Hello World!</p></div></code></div></pre>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
```matlab annotate
% @dim
% This is a single-line comment in MATLAB.

variable = 10;
% --
% ^
% [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: #6A737D">% This is a single-line comment in MATLAB.</span></div><div class="line"></div><div class="line"><span style="color: #24292E">variable = </span><span style="color: #005CC5">10</span><span style="color: #24292E">; </span></div><div class="shaku-underline shaku-underline-solid" style="left:11ch"><span class="shaku-underline-line" style="left:0ch">--</span></div><div class="shaku-callout" style="left:4ch"><span class="shaku-callout-arrow" style="left:7ch"></span><p>Hello World!</p></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 @@ -391,6 +391,9 @@ const commentMarkers: Record<string, { head?: RegExp; tail?: RegExp }> = {
asm: {
head: /^\s*;/,
},
cobol: {
head: /^\s*\*/,
},
};

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

1 comment on commit a5f2248

@vercel
Copy link

@vercel vercel bot commented on a5f2248 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-jserzanp.vercel.app
shaku-web-git-main-jserzanp.vercel.app
shaku-web.vercel.app

Please sign in to comment.