How to save canvas as SVG from the API in Ketcher
To generate image please use the following steps:
H2O
serialize struct to string:
const struct = await ketcher.getKet()
generate Blob:
const imgBlob = await ketcher.generateImage(struct) - png
or
const imgBlob = await ketcher.generateImage(struct, *options)
*options is an object with 'outputFormat' ('svg' or 'png') and 'backgroundColor' (optional) properties. for example:
let options = {outputFormat: 'svg'}
Also see issue
Markdig Usage Examples
Open Autolinks in New Window
If you only care about auto links (links that just appear in the text and arent defined as foo or
var pipeline = new MarkdownPipelineBuilder()
.UseAutoLinks(new AutoLinkOptions { OpenInNewWindow = true })
.Build();
To get the same effect on all links, the easiest way is probably to post-process the document and add the attributes.
MarkdownDocument document = Markdown.Parse(markdown, pipeline);
foreach (LinkInline link in document.Descendants<LinkInline>())
{
link.GetAttributes().AddPropertyIfNotExist("target", "_blank");
}
foreach (AutolinkInline link in document.Descendants<AutolinkInline>())
{
link.GetAttributes().AddPropertyIfNotExist("target", "_blank");
}
string html = document.ToHtml(pipeline);
Also see issue
Linke breaks
To enable parse soft line breaks as hard line breaks
var pipeline = new MarkdownPipelineBuilder()
.UseSoftlineBreakAsHardlineBreak()
.Build();
Katex
Markdig support mathematics expression. Using this code to enable it.
MarkdownPipeline pipeline = new MarkdownPipelineBuilder()
.UseMathematics()
.Build();
Then you can write math expression in your markdown document.
$$
\sum_{k=0}^{log_4^N}\frac{3}{4^k}Nk
$$
This code will be rendered as:
\[
\sum_{k=0}^{log_4^N}\frac{3}{4^k}Nk
\]
$$
\begin{array}{cc}
a & b \\
c & d
\end{array}
$$
This code will be rendered as:
\[
\begin{array}{cc}
a & b \\
c & d
\end{array}
\]