Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,11 @@ Bracket pair colorizers interfere with the rendering. If you use one, install th

---

# FAQ
## Q: How to make Images Preview always maximized
Set vscode settings `Workbench › Panel: Opens Maximized` as `always`.


# **Differences**

| | Markless | Typora |
Expand Down
7 changes: 5 additions & 2 deletions src/extension.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const vscode = require('vscode');
const { hideDecoration, transparentDecoration, getUrlDecoration, getSvgDecoration } = require('./common-decorations');
const { state } = require('./state');
const { memoize, nodeToHtml, svgToUri, htmlToSvg, DefaultMap, texToSvg, enableHoverImage } = require('./util');
const { memoize, nodeToHtml, svgToUri, htmlToSvg, DefaultMap, texToSvg, enableHoverImage, path } = require('./util');
const { triggerUpdateDecorations, addDecoration, posToRange } = require('./runner');
const cheerio = require('cheerio');

Expand Down Expand Up @@ -325,7 +325,10 @@ function bootstrap(context) {
if (!match) return;
addDecoration(hideDecoration, start, start + 2);
addDecoration(getUrlDecoration(true), start + match[1].length + 2, end);
state.imageList.push([posToRange(start, end), node.url, node.alt || " "]);
const editor = vscode.window.activeTextEditor;
const mdFilePath = editor.document.uri.fsPath;
const imgPath =path.resolve(path.dirname(mdFilePath), node.url);
state.imageList.push([posToRange(start, end), imgPath, node.alt || " "]);
}]],
["emphasis", ["delete", (() => {
const strikeDecoration = vscode.window.createTextEditorDecorationType({
Expand Down
4 changes: 3 additions & 1 deletion src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,6 @@ const nodeToHtml = (() => {
return (/** @type {import("unist").Node} */ node) => toHtml(toHast(node));
})();

module.exports = { DefaultMap, memoize, urlToUri, svgToUri, htmlToSvg, parser, nodeToHtml, texToSvg, enableHoverImage };
const path = require('path');

module.exports = { DefaultMap, memoize, urlToUri, svgToUri, htmlToSvg, parser, nodeToHtml, texToSvg, enableHoverImage, path };