Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(props) {
super(props);
this.sendUbbTopic = this.sendUbbTopic.bind(this);
this.changeEditor = this.changeEditor.bind(this);
this.showManagement = this.showManagement.bind(this);
this.onChange = this.onChange.bind(this);
this.close = this.close.bind(this);
this.update = this.update.bind(this);
let initContent = "";
if (Utility.getLocalStorage("temporaryContent-" + this.props.topicInfo.id)) {
initContent = Utility.getLocalStorage("temporaryContent-" + this.props.topicInfo.id);
}
this.converter = new Showdown.Converter({ tables: true, simplifiedAutoLink: true, extensions: [xssFilter] });
this.state = ({ content: initContent, mode: 0, masters: [], buttonDisabled: false, buttonInfo: "回复", manageVisible: false, mdeState: initContent, commands: [] });
}
// handleValueChange = (mdeState: ReactMdeTypes.MdeState) => {
docs.forEach(item => {
// 获取所有需要的用户id
if(item.uid && userIDList.indexOf(item.uid) === -1){
userIDList.push(item.uid)
}
// 内容由 markdown 转为 html
let markdownConverter = new showdown.Converter()
let content = encodeHtml(item.content)
item.content = markdownConverter.makeHtml(content)
})
// 挨个构建获取用户信息对象
match = decodeHtml(match);
var lang = (left.match(/class=\"([^ \"]+)/) || [])[1];
console.log(left + hljs.highlight(lang, match).value + right);
if (lang) {
return left + hljs.highlight(lang, match).value + right;
}
else {
return left + hljs.highlightAuto(match).value + right;
}
};
return showdown.helper.replaceRecursiveRegExp(text, replacement, left, right, flags);
}
}];
}
;
export var convertor = new showdown.Converter({
extensions: [showdownHighlight]
});
var lang = (left.match(/class=\"([^ \"]+)/) || [])[1];
console.log(left + hljs.highlight(lang, match).value + right);
if (lang) {
return left + hljs.highlight(lang, match).value + right;
} else {
return left + hljs.highlightAuto(match).value + right;
}
};
return showdown.helper.replaceRecursiveRegExp(text, replacement, left, right, flags);
}
}];
};
export const convertor = new showdown.Converter({
extensions: [showdownHighlight]
});
constructor(props: IMarkdownEditorProps)
{
super(props);
this.onMdeChange = this.onMdeChange.bind(this);
this.state = {
mdeState: {
markdown: "**Hello, World**"
}
};
this.converter = new Showdown.Converter({ tables: true, simplifiedAutoLink: true });
}
constructor(
private http: HttpClient,
private sanitizer: DomSanitizer
) {
this.isLoading = true;
this.converter = new Converter();
this.subscrition = this.http.get(README_URL, { responseType: 'text' }).subscribe(markdown => {
this.html = this.sanitizer.bypassSecurityTrustHtml(this.converter.makeHtml(markdown));
this.initHightlight();
this.isLoading = false;
}, () => this.isLoading = false);
}
constructor(context: vscode.ExtensionContext, {rules, style}) {
this.context = context;
this.rules = rules;
this.style = style;
showdown.setFlavor('github');
this.converter = new showdown.Converter({extensions: [showdownHtmlEscape]});
//this.imgBug = new Buffer(fs.readFileSync(path.resolve(this.context.extensionPath, "resources", "fa-bug.png"))).toString('base64');
}
constructor(props) {
super(props);
this.state = {
value: "Permissions Not Granted",
tab: "write"
};
this.converter = new Showdown.Converter({
tables: true,
simplifiedAutoLink: true,
strikethrough: true,
tasklists: true
});
}
env.addFilter('markdown', (text) => {
const converter = new showdown.Converter();
return converter.makeHtml(text);
});
module.exports = function () {
const mdPath = path.resolve(paths.basePath, 'README.md');
log(mdPath, '-', 'converting...');
const md = fs.readFileSync(mdPath, 'utf-8');
showdown.setFlavor('github');
const converter = new showdown.Converter();
const html = converter.makeHtml(md);
const tpl = fs.readFileSync(paths.exampleTplPath, 'utf-8');
fs.outputFileSync(paths.exampleMdPath, tpl.replace(/{{\$markdown}}/, html), 'utf-8');
log(mdPath, '-', 'convert md to html success!');
}