Clean up partial API tags'
This commit is contained in:
parent
2586cfa9b0
commit
69232395fd
|
@ -0,0 +1,8 @@
|
|||
const cleanApiTags = (html: string): string => {
|
||||
return html.replace(
|
||||
/\[api:(.*?)\]\s/,
|
||||
(_, query) => `<a href="${query}">${query}</a> `
|
||||
)
|
||||
};
|
||||
|
||||
export default cleanApiTags;
|
|
@ -1,6 +1,7 @@
|
|||
import parse, { DomElement } from 'html-react-parser';
|
||||
import cleanChildrenTags from './cleanChildrenTags';
|
||||
import cleanWhitespace from './cleanWhitespace';
|
||||
import cleanApiTags from './cleanApiTags';
|
||||
import rewriteLink from './rewriteLink';
|
||||
import parseChildrenOf from './parseChildrenOf';
|
||||
import cleanCalloutTags from './cleanCalloutTags';
|
||||
|
@ -13,9 +14,11 @@ import rewriteHeader from './rewriteHeader';
|
|||
* @return ReactElement | ReactElement[] | string
|
||||
*/
|
||||
const parseHTML = (html: string): ReactElement | ReactElement[] | string => {
|
||||
let cleanHTML = cleanChildrenTags(html);
|
||||
let cleanHTML = html;
|
||||
cleanHTML = cleanChildrenTags(cleanHTML);
|
||||
cleanHTML = cleanCalloutTags(cleanHTML);
|
||||
cleanHTML = cleanWhitespace(cleanHTML);
|
||||
cleanHTML = cleanApiTags(cleanHTML);
|
||||
|
||||
const parseOptions = {
|
||||
replace(domNode: DomElement): ReactElement | object | undefined | false {
|
||||
|
|
Loading…
Reference in New Issue