mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-01 02:12:36 +02:00
Fixes one warning in console for React.DOM.* usage.
This commit is contained in:
parent
1872df78ae
commit
a83e16308b
2 changed files with 27 additions and 25 deletions
|
@ -10,6 +10,7 @@
|
|||
/* Marked component is used to parse markdown to html */
|
||||
|
||||
const React = require("react");
|
||||
import DOM from 'react-dom-factories';
|
||||
const Prism = require("./Prism.js");
|
||||
const Header = require("./Header.js");
|
||||
|
||||
|
@ -565,7 +566,7 @@ InlineLexer.prototype.output = function(src) {
|
|||
text = cap[1];
|
||||
href = text;
|
||||
}
|
||||
out.push(React.DOM.a({ href: this.sanitizeUrl(href) }, text));
|
||||
out.push(DOM.a({ href: this.sanitizeUrl(href) }, text));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -574,7 +575,7 @@ InlineLexer.prototype.output = function(src) {
|
|||
src = src.substring(cap[0].length);
|
||||
text = cap[1];
|
||||
href = text;
|
||||
out.push(React.DOM.a({ href: this.sanitizeUrl(href) }, text));
|
||||
out.push(DOM.a({ href: this.sanitizeUrl(href) }, text));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -618,35 +619,35 @@ InlineLexer.prototype.output = function(src) {
|
|||
// strong
|
||||
if ((cap = this.rules.strong.exec(src))) {
|
||||
src = src.substring(cap[0].length);
|
||||
out.push(React.DOM.strong(null, this.output(cap[2] || cap[1])));
|
||||
out.push(DOM.strong(null, this.output(cap[2] || cap[1])));
|
||||
continue;
|
||||
}
|
||||
|
||||
// em
|
||||
if ((cap = this.rules.em.exec(src))) {
|
||||
src = src.substring(cap[0].length);
|
||||
out.push(React.DOM.em(null, this.output(cap[2] || cap[1])));
|
||||
out.push(DOM.em(null, this.output(cap[2] || cap[1])));
|
||||
continue;
|
||||
}
|
||||
|
||||
// code
|
||||
if ((cap = this.rules.code.exec(src))) {
|
||||
src = src.substring(cap[0].length);
|
||||
out.push(React.DOM.code(null, cap[2]));
|
||||
out.push(DOM.code(null, cap[2]));
|
||||
continue;
|
||||
}
|
||||
|
||||
// br
|
||||
if ((cap = this.rules.br.exec(src))) {
|
||||
src = src.substring(cap[0].length);
|
||||
out.push(React.DOM.br(null, null));
|
||||
out.push(DOM.br(null, null));
|
||||
continue;
|
||||
}
|
||||
|
||||
// del (gfm)
|
||||
if ((cap = this.rules.del.exec(src))) {
|
||||
src = src.substring(cap[0].length);
|
||||
out.push(React.DOM.del(null, this.output(cap[1])));
|
||||
out.push(DOM.del(null, this.output(cap[1])));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -695,7 +696,7 @@ InlineLexer.prototype.outputLink = function(cap, link) {
|
|||
const shouldOpenInNewWindow =
|
||||
link.href.charAt(0) !== "/" && link.href.charAt(0) !== "#";
|
||||
|
||||
return React.DOM.a(
|
||||
return DOM.a(
|
||||
{
|
||||
href: this.sanitizeUrl(link.href),
|
||||
title: link.title,
|
||||
|
@ -704,7 +705,7 @@ InlineLexer.prototype.outputLink = function(cap, link) {
|
|||
this.output(cap[1])
|
||||
);
|
||||
} else {
|
||||
return React.DOM.img(
|
||||
return DOM.img(
|
||||
{
|
||||
src: this.sanitizeUrl(link.href),
|
||||
alt: cap[1],
|
||||
|
@ -806,7 +807,7 @@ Parser.prototype.tok = function() {
|
|||
return [];
|
||||
}
|
||||
case "hr": {
|
||||
return React.DOM.hr(null, null);
|
||||
return DOM.hr(null, null);
|
||||
}
|
||||
case "heading": {
|
||||
return (
|
||||
|
@ -835,7 +836,7 @@ Parser.prototype.tok = function() {
|
|||
for (i = 0; i < this.token.header.length; i++) {
|
||||
heading = this.inline.output(this.token.header[i]);
|
||||
row.push(
|
||||
React.DOM.th(
|
||||
DOM.th(
|
||||
this.token.align[i]
|
||||
? { style: { textAlign: this.token.align[i] } }
|
||||
: null,
|
||||
|
@ -843,7 +844,7 @@ Parser.prototype.tok = function() {
|
|||
)
|
||||
);
|
||||
}
|
||||
table.push(React.DOM.thead(null, React.DOM.tr(null, row)));
|
||||
table.push(DOM.thead(null, DOM.tr(null, row)));
|
||||
|
||||
// body
|
||||
for (i = 0; i < this.token.cells.length; i++) {
|
||||
|
@ -851,7 +852,7 @@ Parser.prototype.tok = function() {
|
|||
cells = this.token.cells[i];
|
||||
for (j = 0; j < cells.length; j++) {
|
||||
row.push(
|
||||
React.DOM.td(
|
||||
DOM.td(
|
||||
this.token.align[j]
|
||||
? { style: { textAlign: this.token.align[j] } }
|
||||
: null,
|
||||
|
@ -859,11 +860,11 @@ Parser.prototype.tok = function() {
|
|||
)
|
||||
);
|
||||
}
|
||||
body.push(React.DOM.tr(null, row));
|
||||
body.push(DOM.tr(null, row));
|
||||
}
|
||||
table.push(React.DOM.thead(null, body));
|
||||
table.push(DOM.thead(null, body));
|
||||
|
||||
return React.DOM.table(null, table);
|
||||
return DOM.table(null, table);
|
||||
}
|
||||
case "blockquote_start": {
|
||||
const body = [];
|
||||
|
@ -872,7 +873,7 @@ Parser.prototype.tok = function() {
|
|||
body.push(this.tok());
|
||||
}
|
||||
|
||||
return React.DOM.blockquote(null, body);
|
||||
return DOM.blockquote(null, body);
|
||||
}
|
||||
case "list_start": {
|
||||
const type = this.token.ordered ? "ol" : "ul";
|
||||
|
@ -882,7 +883,7 @@ Parser.prototype.tok = function() {
|
|||
body.push(this.tok());
|
||||
}
|
||||
|
||||
return React.DOM[type](null, body);
|
||||
return DOM[type](null, body);
|
||||
}
|
||||
case "list_item_start": {
|
||||
const body = [];
|
||||
|
@ -891,7 +892,7 @@ Parser.prototype.tok = function() {
|
|||
body.push(this.token.type === "text" ? this.parseText() : this.tok());
|
||||
}
|
||||
|
||||
return React.DOM.li(null, body);
|
||||
return DOM.li(null, body);
|
||||
}
|
||||
case "loose_item_start": {
|
||||
const body = [];
|
||||
|
@ -900,10 +901,10 @@ Parser.prototype.tok = function() {
|
|||
body.push(this.tok());
|
||||
}
|
||||
|
||||
return React.DOM.li(null, body);
|
||||
return DOM.li(null, body);
|
||||
}
|
||||
case "html": {
|
||||
return React.DOM.div({
|
||||
return DOM.div({
|
||||
dangerouslySetInnerHTML: {
|
||||
__html: this.token.text
|
||||
}
|
||||
|
@ -915,12 +916,12 @@ Parser.prototype.tok = function() {
|
|||
null,
|
||||
this.inline.output(this.token.text)
|
||||
)
|
||||
: React.DOM.p(null, this.inline.output(this.token.text));
|
||||
: DOM.p(null, this.inline.output(this.token.text));
|
||||
}
|
||||
case "text": {
|
||||
return this.options.paragraphFn
|
||||
? this.options.paragraphFn.call(null, this.parseText())
|
||||
: React.DOM.p(null, this.parseText());
|
||||
: DOM.p(null, this.parseText());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1045,8 +1046,8 @@ function marked(src, opt, callback) {
|
|||
e.message += "\nPlease report this to https://github.com/chjj/marked.";
|
||||
if ((opt || marked.defaults).silent) {
|
||||
return [
|
||||
React.DOM.p(null, "An error occurred:"),
|
||||
React.DOM.pre(null, e.message)
|
||||
DOM.p(null, "An error occurred:"),
|
||||
DOM.pre(null, e.message)
|
||||
];
|
||||
}
|
||||
throw e;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"prettier": "^1.5.3",
|
||||
"react": "^15.5.4",
|
||||
"react-dom": "^15.5.4",
|
||||
"react-dom-factories": "^1.0.1",
|
||||
"request": "^2.81.0",
|
||||
"shelljs": "^0.7.8"
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue