mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 10:12:34 -05:00
Fix Windows WYSIWYG linking issue (switching to splitview and resolving links in WYSIWYG) (#16133)
* fix relative links not correctly formatted due to marked js * logic in one place
This commit is contained in:
@@ -53,15 +53,22 @@ suite('NotebookMarkdownRenderer', () => {
|
||||
});
|
||||
|
||||
test('link from relative file path', () => {
|
||||
notebookMarkdownRenderer.setNotebookURI(URI.parse('maddy/temp/file1.txt'));
|
||||
notebookMarkdownRenderer.setNotebookURI(URI.parse(`foo/temp/file1.txt`));
|
||||
let result: HTMLElement = notebookMarkdownRenderer.renderMarkdown({ value: `[Link to relative path](../test/.build/someimageurl)`, isTrusted: true });
|
||||
if (process.platform === 'win32') {
|
||||
assert.strictEqual(result.innerHTML, `<p><a href="\\maddy\\test\\.build\\someimageurl" data-href="\\maddy\\test\\.build\\someimageurl" title="\\maddy\\test\\.build\\someimageurl">Link to relative path</a></p>`);
|
||||
assert.strictEqual(result.innerHTML, `<p><a href="\\foo\\test\\.build\\someimageurl" data-href="\\foo\\test\\.build\\someimageurl" title="\\foo\\test\\.build\\someimageurl">Link to relative path</a></p>`);
|
||||
} else {
|
||||
assert.strictEqual(result.innerHTML, `<p><a href="/maddy/test/.build/someimageurl" data-href="/maddy/test/.build/someimageurl" title="/maddy/test/.build/someimageurl">Link to relative path</a></p>`);
|
||||
assert.strictEqual(result.innerHTML, `<p><a href="/foo/test/.build/someimageurl" data-href="/foo/test/.build/someimageurl" title="/foo/test/.build/someimageurl">Link to relative path</a></p>`);
|
||||
}
|
||||
});
|
||||
|
||||
// marked js test that alters the relative path requiring regex replace to resolve path properly
|
||||
// Issue tracked here: https://github.com/markedjs/marked/issues/2135
|
||||
test('marked js compiles relative link incorrectly', () => {
|
||||
const markedPath = marked.parse('..\\..\\test.ipynb');
|
||||
assert.strict(markedPath, '<p>....\test.ipynb</p>');
|
||||
});
|
||||
|
||||
test('cell attachment image', () => {
|
||||
let result: HTMLElement = notebookMarkdownRenderer.renderMarkdown({ value: ``, isTrusted: true }, { cellAttachments: JSON.parse('{"ads.png":{"image/png":"iVBORw0KGgoAAAANSUhEUgAAAggg=="}}') });
|
||||
assert.strictEqual(result.innerHTML, `<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAggg==" alt="altText"></p>`, 'Cell attachment basic test failed when trusted');
|
||||
|
||||
Reference in New Issue
Block a user