forked from simov/markdown-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
11 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
// Import necessary modules from the @mixmark-io/domino package | ||
import { createWindow, createDocument } from '@mixmark-io/domino'; | ||
import { createDocument } from "domino"; | ||
|
||
// Export the modules for use in your project | ||
export { createWindow, createDocument }; | ||
export default createDocument; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
if (!window.TurndownScript) { | ||
const turndownScript = document.createElement('script'); | ||
turndownScript.src = chrome.runtime.getURL('vendor/turndown/turndown.browser.umd.js'); | ||
document.head.appendChild(turndownScript); | ||
window.TurndownScript = turndownScript; | ||
} | ||
|
||
window.TurndownScript.onload = () => { | ||
const turndownScript = document.createElement('script'); | ||
turndownScript.src = chrome.runtime.getURL('vendor/turndown.min.js'); | ||
const dominoScript = document.createElement('script'); | ||
dominoScript.src = chrome.runtime.getURL('vendor/domino.min.js'); | ||
turndownScript.onload = () => { | ||
const turndownService = new TurndownService(); | ||
const markdown = turndownService.turndown(document.documentElement.outerHTML); | ||
console.log(markdown); | ||
|
||
// Create a new window to display the Markdown | ||
const markdownWindow = window.open('', '_blank'); | ||
markdownWindow.document.write('<pre>' + markdownWindow.document.createTextNode(markdown).textContent + '</pre>'); | ||
}; | ||
}; | ||
document.head.appendChild(dominoScript); | ||
document.head.appendChild(turndownScript); |