Skip to content

Commit

Permalink
Release/1.0.18 (#26)
Browse files Browse the repository at this point in the history
* Added support to C#, JSON (#25)

* 1.0.18

* 1.0.18

* 1.0.18

Co-authored-by: Igor Moskalenko <[email protected]>
  • Loading branch information
GreenAsh and igor-miro authored Nov 20, 2022
1 parent 9d0975f commit 91af398
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 12 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,13 @@ typings/
# next.js build output
.next
package-lock.json

# yarn
yarn.lock

# WebStorm
.idea/*

# macos
.DS_Store
resources/.DS_Store
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ Installation link miro.com
![Widget menu configuration](resources/docs/language-configuration.gif)

### List of supported languages
- c#
- gherkin
- java
- javascript
- json
- typescript

### Themes
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "code-syntax-highlighter",
"version": "1.0.17",
"version": "1.0.18",
"description": "",
"main": "",
"scripts": {
Expand All @@ -14,7 +14,7 @@
"license": "MIT",
"dependencies": {
"@sentry/browser": "^6.14.1",
"prismjs": "^1.25.0"
"prismjs": "^1.29.0"
},
"devDependencies": {
"@sentry/typescript": "^5.20.1",
Expand All @@ -27,6 +27,7 @@
"tslint": "^5.20.1",
"typescript": "^3.7.2",
"webpack": "^5.62.1",
"webpack-cli": "^4.9.1"
"webpack-cli": "^4.9.1",
"http-server": "^14.1.1"
}
}
Binary file added resources/icons/csharp.idraw
Binary file not shown.
7 changes: 7 additions & 0 deletions resources/icons/csharp.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icons/json.idraw
Binary file not shown.
6 changes: 6 additions & 0 deletions resources/icons/json.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/code-highlighter/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const LANGUAGES = ['java', 'js', 'ts', 'gherkin'];
export const LANGUAGES = ['java', 'js', 'ts', 'gherkin', 'csharp', 'json'];
export const DEFAULT_THEME = 'okaidia';

export class DOM {
Expand Down
24 changes: 24 additions & 0 deletions src/code-highlighter/prism/factories/csharp.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import 'prismjs/components/prism-csharp';
import {CLikeTokenFactory} from './clike'
import {DOM} from "../../config";

class CSharpTokenFactory extends CLikeTokenFactory {
create(name: String, className: string): Node | false | null {
const result = super.create(name, className);
if (result !== null) {
return result;
}
switch (name) {
case 'namespace':
case 'generics':
case 'annotation':
case 'constructor-invocation':
case 'return-type':
return DOM.createElement('span', className);
default:
return null;
}
}
}

export const csharp = new CSharpTokenFactory();
10 changes: 7 additions & 3 deletions src/code-highlighter/prism/factories/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import 'prismjs/components/prism-typescript';
import 'prismjs/components/prism-json';

import { csharp } from './csharp'
import { gherkin } from './gherkin'
import { java } from './java'
import { javascript } from './javascript'
import { gherkin } from './gherkin'

export const factories = new Map<String, TokenFactory>();
factories.set('csharp', csharp);
factories.set('gherkin', gherkin);
factories.set('java', java);
factories.set('js', javascript);
factories.set('ts', javascript);
factories.set('gherkin', gherkin);
factories.set('json', javascript);
factories.set('ts', javascript);
9 changes: 6 additions & 3 deletions src/miro-plugin/icons.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import mainData from '../../resources/icons/main.svg'
import csharp from '../../resources/icons/csharp.svg'
import javaData from '../../resources/icons/java.svg'
import jsData from '../../resources/icons/js.svg'
import jsonData from '../../resources/icons/json.svg'
import tsData from '../../resources/icons/ts.svg'
import cucumberData from '../../resources/icons/cucumber.svg'
import {LanguageDescription} from "../settings/shared-settings";

export const mainIcon = mainData;
export const langKey2IconData: Map<string, string> = new Map([
['csharp', csharp],
['gherkin', cucumberData],
['java', javaData],
['js', jsData],
['ts', tsData],
['gherkin', cucumberData]
['json', jsonData],
['ts', tsData]
]);

6 changes: 4 additions & 2 deletions src/settings/shared-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ export interface LanguageDescription {

export const langKey2Description: Map<string, LanguageDescription> = new Map([
['none', {key: 'none', displayName: 'None'}],
['csharp', {key: 'csharp', displayName: 'C#'}],
['gherkin', {key: 'gherkin', displayName: 'Gherkin'}],
['java', {key: 'java', displayName: 'Java'}],
['js', {key: 'js', displayName: 'JavaScript'}],
['ts', {key: 'ts', displayName: 'TypeScript'}],
['gherkin', {key: 'gherkin', displayName: 'Gherkin'}]
['json', { key: 'json', displayName: 'JSON'}],
['ts', {key: 'ts', displayName: 'TypeScript'}]
]);
const defaultMenuButtons: string[] = ['java', 'js', 'ts']

Expand Down

0 comments on commit 91af398

Please sign in to comment.