Skip to content

Commit da87cd7

Browse files
authored
Merge pull request #1 from codex-editor/initial
Inline Code Tool
2 parents 02ec2e3 + 96119dd commit da87cd7

11 files changed

Lines changed: 5666 additions & 2 deletions

File tree

.gitattributes

Lines changed: 0 additions & 2 deletions
This file was deleted.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/*
2+
npm-debug.log
3+
.idea/
4+
.DS_Store

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 CodeX
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
![](https://badgen.net/badge/CodeX%20Editor/v2.0/blue)
2+
3+
# InlineCode Tool
4+
5+
Inline Tool for marking code-fragments for the [CodeX Editor](https://ifmo.su/editor).
6+
7+
![](assets/example.gif)
8+
9+
## Installation
10+
11+
### Install via NPM
12+
13+
Get the package
14+
15+
```shell
16+
npm i --save-dev codex.editor.inline-code
17+
```
18+
19+
Include module at your application
20+
21+
```javascript
22+
const InlineCode = require('codex.editor.inline-code');
23+
```
24+
25+
### Download to your project's source dir
26+
27+
1. Upload folder `dist` from repository
28+
2. Add `dist/bundle.js` file to your page.
29+
30+
### Load from CDN
31+
32+
Get newest bundle path from [RawGit](https://rawgit.com) — open site and paste link to JS bundle in repository.
33+
34+
`https://github.com/codex-editor/inline-code/blob/master/dist/bundle.js`
35+
36+
> Note: use `production` link with commit hash to avoid issues with caching.
37+
38+
Then require this script on page with CodeX Editor.
39+
40+
```html
41+
<script src="..."></script>
42+
```
43+
44+
## Usage
45+
46+
Add a new Tool to the `tools` property of the CodeX Editor initial config.
47+
48+
```javascript
49+
var editor = CodexEditor({
50+
...
51+
52+
tools: {
53+
...
54+
inlineCode: {
55+
class: InlineCode,
56+
shortcut: 'CMD+SHIFT+M',
57+
},
58+
},
59+
60+
...
61+
});
62+
```
63+
64+
## Config Params
65+
66+
This Tool has no config params
67+
68+
## Output data
69+
70+
Marked text will be wrapped with a `span` tag with an `inline-code` class.
71+
72+
```json
73+
{
74+
"type" : "text",
75+
"data" : {
76+
"text" : "Create a directory for your module, enter it and run <span class=\"inline-code\">npm init</span> command."
77+
}
78+
}
79+
```
80+

assets/example.gif

651 KB
Loading

dist/bundle.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)