Skip to content

Commit

Permalink
Merge pull request #130 from frogkind/67
Browse files Browse the repository at this point in the history
Fix issue #67
  • Loading branch information
OliverBalfour authored Sep 25, 2022
2 parents c827d64 + 4a751c9 commit 4f3991f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"dependencies": {
"@types/temp": "^0.9.0",
"lookpath": "^1.2.0",
"js-base64": "^3.7.2",
"temp": "^0.9.4",
"yaml": "^2.0.0-4"
}
Expand Down
3 changes: 2 additions & 1 deletion renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import * as path from 'path';
import * as fs from 'fs';
import * as YAML from 'yaml';
import { Base64 } from 'js-base64';

import { FileSystemAdapter, MarkdownRenderer, MarkdownView, Notice } from 'obsidian';

Expand Down Expand Up @@ -267,7 +268,7 @@ function convertSVGToPNG(svg: SVGSVGElement, scale: number = 1): Promise<HTMLIma
canvas.height = Math.ceil(svg.height.baseVal.value * scale);
const ctx = canvas.getContext('2d');
var svgImg = new Image;
svgImg.src = "data:image/svg+xml;base64," + btoa(svg.outerHTML);
svgImg.src = "data:image/svg+xml;base64," + Base64.encode(svg.outerHTML);
return new Promise((resolve, reject) => {
svgImg.onload = () => {
ctx.drawImage(svgImg, 0, 0, canvas.width, canvas.height);
Expand Down

0 comments on commit 4f3991f

Please sign in to comment.