Skip to content

Commit

Permalink
Change to clean project, update, refactor scripts
Browse files Browse the repository at this point in the history
Reviewed-by: Christian Murphy <christian.murphy.42@gmail.com>

Closes GH-476.
  • Loading branch information
wooorm committed Oct 15, 2020
1 parent ebebf51 commit 4f1a407
Show file tree
Hide file tree
Showing 31 changed files with 428 additions and 12,786 deletions.
23 changes: 15 additions & 8 deletions .babelrc
@@ -1,18 +1,25 @@
{
"presets": [
"@babel/preset-react",
["@babel/preset-env", {
"targets": {
"browsers": ["ie >= 9"]
[
"@babel/preset-env",
{
"targets": {
"browsers": ["ie >= 9"]
}
}
}]
]
],

"env": {
"production": {
"plugins": [["transform-react-remove-prop-types", {
"removeImport": true
}]]
"plugins": [
[
"transform-react-remove-prop-types",
{
"removeImport": true
}
]
]
}
}
}
20 changes: 1 addition & 19 deletions .editorconfig
@@ -1,27 +1,9 @@
# http://editorconfig.org
root = true

[*]
# Use hard or soft tabs
indent_style = space

# Size of a single indent
indent_size = tab

# Number of columns representing a tab character
tab_width = 2

# Use line-feed as EOL indicator
indent_size = 2
end_of_line = lf

# Use UTF-8 character encoding for all files
charset = utf-8

# Remove any whitespace characters preceding newline characters
trim_trailing_whitespace = true

# Ensure file ends with a newline when saving
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
8 changes: 4 additions & 4 deletions .eslintignore
@@ -1,4 +1,4 @@
coverage
demo/dist
umd
lib
coverage/
demo/dist/
lib/
umd/
12 changes: 0 additions & 12 deletions .eslintrc

This file was deleted.

40 changes: 6 additions & 34 deletions .gitignore
@@ -1,36 +1,8 @@
# Logs
logs
coverage/
lib/
node_modules/
umd/
*.log

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
vendor

# UMD build
umd

# Babelified
lib

# Yarn lockfile
.DS_Store
package-lock.json
yarn.lock
18 changes: 0 additions & 18 deletions .npmignore

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
@@ -0,0 +1 @@
package-lock=false
8 changes: 7 additions & 1 deletion .prettierignore
@@ -1 +1,7 @@
test/fixtures/runthrough.md
coverage/
demo/dist/js/demo.js
lib/
umd/
*.html
*.json
*.md
6 changes: 0 additions & 6 deletions .prettierrc

This file was deleted.

5 changes: 2 additions & 3 deletions .travis.yml
@@ -1,8 +1,7 @@
language: node_js
node_js:
- '10'
- '12'
- '14'
- lts/dubnium
- node
after_script:
- npm install codeclimate-test-reporter && cat coverage/lcov.info | codeclimate
env:
Expand Down
7 changes: 3 additions & 4 deletions README.md
Expand Up @@ -2,7 +2,7 @@

Renders Markdown as pure React components.

[![npm version](https://img.shields.io/npm/v/react-markdown.svg?style=flat-square)](https://www.npmjs.com/package/react-markdown)[![Build Status](https://img.shields.io/travis/rexxars/react-markdown/master.svg?style=flat-square)](https://travis-ci.org/rexxars/react-markdown)
[![npm version](https://img.shields.io/npm/v/react-markdown.svg?style=flat-square)](https://www.npmjs.com/package/react-markdown)[![Build Status](https://img.shields.io/travis/remarkjs/react-markdown/master.svg?style=flat-square)](https://travis-ci.org/remarkjs/react-markdown)

Demo available at https://remarkjs.github.io/react-markdown/

Expand Down Expand Up @@ -89,8 +89,7 @@ this is a Good Thing™.
- `renderers` - _object_ An object where the keys represent the node type and the value is a React
component. The object is merged with the default renderers. The props passed to the component
varies based on the type of node.
- `plugins` - _array_ An array of unified/remark parser plugins. If you need to pass options to the plugin, pass an array with two elements, the first being the plugin and the second being the options - for instance: `{plugins: [[require('remark-shortcodes'), {your: 'options'}]]`. (default: `[]`) Note that [not all plugins can be used](https://github.com/rexxars/react-markdown/issues/188#issuecomment-404710893).
- `parserOptions` - _object_ An object containing options to pass to [remark-parse](https://github.com/remarkjs/remark/tree/main/packages/remark-parse).
- `plugins` - _array_ An array of unified/remark parser plugins. If you need to pass options to the plugin, pass an array with two elements, the first being the plugin and the second being the options - for instance: `{plugins: [[require('remark-gfm'), {singleTilde: false}]]`. (default: `[]`) Note that [not all plugins can be used](https://github.com/remarkjs/react-markdown/issues/188#issuecomment-404710893).

## Parsing HTML

Expand Down Expand Up @@ -169,7 +168,7 @@ children text nodes.
## Developing

```bash
git clone git@github.com:rexxars/react-markdown.git
git clone git@github.com:remarkjs/react-markdown.git
cd react-markdown
npm install
npm test
Expand Down
4 changes: 1 addition & 3 deletions demo/dist/index.html
Expand Up @@ -14,7 +14,7 @@

<body>

<a href="https://github.com/rexxars/react-markdown" class="fork-ribbon"><img style="z-index: 5001; position: absolute; top: 0; right: 0; border: 0;"
<a href="https://github.com/remarkjs/react-markdown" class="fork-ribbon"><img style="z-index: 5001; position: absolute; top: 0; right: 0; border: 0;"
src="https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67"
alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png"></a>

Expand All @@ -23,8 +23,6 @@ <h1 class="page-header">react-markdown</h1>
<main id="main"></main>
</div>

<script crossorigin src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.11.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.2/codemirror.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.2/mode/markdown/markdown.min.js"></script>
Expand Down
51 changes: 31 additions & 20 deletions demo/dist/js/demo.js

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions demo/src/codemirror.js
Expand Up @@ -8,15 +8,15 @@ const CodeMirror = window.CodeMirror
// also used as an example:
// https://github.com/facebook/react/blob/master/src/browser/ui/dom/components/ReactDOMInput.js

const IS_MOBILE = typeof navigator === 'undefined' || (
navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
)
const IS_MOBILE =
typeof navigator === 'undefined' ||
navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/BlackBerry/i) ||
navigator.userAgent.match(/Windows Phone/i)

class CodeMirrorEditor extends React.Component {
constructor(props) {
Expand All @@ -27,10 +27,10 @@ class CodeMirrorEditor extends React.Component {
}

componentDidMount() {
const isTextArea = this.props.forceTextArea || IS_MOBILE;
const isTextArea = this.props.forceTextArea || IS_MOBILE
if (!isTextArea) {
this.editor = CodeMirror.fromTextArea(this.editorRef.current, this.props);
this.editor.on('change', this.handleChange);
this.editor = CodeMirror.fromTextArea(this.editorRef.current, this.props)
this.editor.on('change', this.handleChange)
}
}

Expand All @@ -41,7 +41,7 @@ class CodeMirrorEditor extends React.Component {

if (this.props.value) {
if (this.editor.getValue() !== this.props.value) {
this.editor.setValue(this.props.value);
this.editor.setValue(this.props.value)
}
}
}
Expand Down Expand Up @@ -79,7 +79,7 @@ class CodeMirrorEditor extends React.Component {
className: this.props.textAreaClassName
})

return React.createElement('div', null, editor);
return React.createElement('div', null, editor)
}
}

Expand Down
8 changes: 2 additions & 6 deletions demo/src/demo.js
Expand Up @@ -47,7 +47,7 @@ Pretty neat, eh?
## More info?
Read usage information and more on [GitHub](//github.com/rexxars/react-markdown)
Read usage information and more on [GitHub](//github.com/remarkjs/react-markdown)
---------------
Expand Down Expand Up @@ -98,8 +98,4 @@ class Demo extends React.PureComponent {
}
}

if (typeof window !== 'undefined') {
ReactDOM.render(<Demo />, document.getElementById('main'))
}

module.exports = Demo
ReactDOM.render(<Demo />, document.getElementById('main'))
23 changes: 3 additions & 20 deletions index.d.ts
@@ -1,5 +1,5 @@
// Type definitions for react-markdown > v3.3.0
// Project: https://github.com/rexxars/react-markdown
// Project: https://github.com/remarkjs/react-markdown
// Definitions by:
// - Ruslan Ibragimov <https://github.com/IRus>
// - Kohei Asai <me@axross.io>
Expand All @@ -25,26 +25,11 @@ declare namespace ReactMarkdown {
readonly indent?: number[]
}

interface RemarkParseOptions {
gfm: boolean
commonmark: boolean
footnotes: boolean
blocks: string[]
pedantic: boolean
}

export type NodeType = Content['type']

export type AlignType =
| "left"
| "right"
| "center"
| null
export type AlignType = 'left' | 'right' | 'center' | null

export type ReferenceType =
| "shortcut"
| "collapsed"
| "full"
export type ReferenceType = 'shortcut' | 'collapsed' | 'full'

export type LinkTargetResolver = (uri: string, text: string, title?: string) => string

Expand Down Expand Up @@ -75,7 +60,6 @@ declare namespace ReactMarkdown {
readonly renderers?: {[nodeType: string]: ReactType}
readonly astPlugins?: PluggableList
readonly plugins?: PluggableList
readonly parserOptions?: Partial<RemarkParseOptions>
}

export var types: NodeType[]
Expand All @@ -86,4 +70,3 @@ declare namespace ReactMarkdown {
declare class ReactMarkdown extends Component<ReactMarkdown.ReactMarkdownProps, {}> {}

export = ReactMarkdown

0 comments on commit 4f1a407

Please sign in to comment.