How to use showdown - 10 common examples

To help you get started, we’ve selected a few showdown examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ZJU-CC98 / Forum / CC98.Forum / CC98.Forum / Components / Topic / Topic-SendTopic.tsx View on Github external
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) => {
github bh-lay / blog / sys / controller / api / comments / list.js View on Github external
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)
	})
	// 挨个构建获取用户信息对象
github Foveluy / Dragact / dist / example / showdown / index.js View on Github external
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]
});
github Foveluy / Dragact / example / showdown / index.ts View on Github external
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]
});
github Smithsonian / dpo-voyager / source / client / story / views / MarkdownEditor.tsx View on Github external
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 });
    }
github hallysonh / ngx-imageviewer / src / app / gettingstarted / gettingstarted.component.ts View on Github external
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);
  }
github deepscan / vscode-deepscan / client / src / actions / showRuleCodeActionProvider.ts View on Github external
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');
    }
github Schachte / WIPCream / UI / wipcream / src / components / Editor.js View on Github external
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
    });
  }
github alphagov / paas-admin / config / nunjucks.config.js View on Github external
env.addFilter('markdown', (text) => {
    const converter = new showdown.Converter();
    return converter.makeHtml(text);
  });
github alienzhou / web-highlighter / script / convet-md.js View on Github external
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!');
}

showdown

A Markdown to HTML converter written in Javascript

MIT
Latest version published 2 years ago

Package Health Score

80 / 100
Full package analysis

Popular showdown functions