Skip to content

Commit 7fb6ae1

Browse files
committed
Include part of the README.md file from the javascript-obfuscator to display available options
1 parent bf36692 commit 7fb6ae1

File tree

7 files changed

+832
-873
lines changed

7 files changed

+832
-873
lines changed

App/containers/OptionsContainer.js

Lines changed: 373 additions & 355 deletions
Large diffs are not rendered by default.

App/styles/main.less

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,7 @@ pre#Html {
124124
width: 100%;
125125
}
126126
}
127+
128+
code {
129+
background-color: #f0f0f0;
130+
}

App/util/get-options-markdown.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from 'react';
2+
const fullReadmeMarkdown = require('javascript-obfuscator/README.md').default;
3+
const emojiDictionary = require('emoji-dictionary');
4+
5+
function flatten(text, child) {
6+
return typeof child === 'string'
7+
? text + child
8+
: React.Children.toArray(child.props.children).reduce(flatten, text)
9+
}
10+
11+
export function headingRenderer(props) {
12+
const children = React.Children.toArray(props.children)
13+
const text = children.reduce(flatten, '')
14+
const slug = text.toLowerCase().replace(/\W/g, '-')
15+
16+
return React.createElement('h' + props.level, {id: slug}, props.children)
17+
}
18+
19+
export const emojiSupportRenderer = text => text.value.replace(/:\w+:/gi, name => emojiDictionary.getUnicode(name));
20+
21+
export function getOptionsMarkdown() {
22+
return fullReadmeMarkdown
23+
.split('<!-- ##options-start## -->')[1]
24+
.split('<!-- ##options-end## -->\n')[0];
25+
}

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"classnames": "2.2.5",
2626
"codemirror": "5.18.2",
2727
"css-loader": "0.28.11",
28+
"emoji-dictionary": "^1.0.11",
2829
"eslint": "4.19.1",
2930
"eslint-plugin-react": "7.7.0",
3031
"express": "4.14.0",
@@ -37,10 +38,12 @@
3738
"less-loader": "4.1.0",
3839
"pm2": "3.5.1",
3940
"prop-types": "15.6.1",
41+
"raw-loader": "^4.0.1",
4042
"react": "16.13.1",
4143
"react-codemirror2": "5.0.1",
4244
"react-dom": "16.13.1",
4345
"react-dropzone": "4.2.9",
46+
"react-markdown": "^4.3.1",
4447
"react-redux": "5.0.7",
4548
"redux": "3.6.0",
4649
"redux-logger": "3.0.6",

templates/index.html

Lines changed: 1 addition & 510 deletions
Large diffs are not rendered by default.

webpack.conf.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ module.exports = {
3636
{
3737
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
3838
loader: "file-loader"
39+
},
40+
{
41+
test: /\.md$/i,
42+
use: 'raw-loader'
3943
}
4044
]
4145
},

0 commit comments

Comments
 (0)