Conversation
There was a problem hiding this comment.
Pull request overview
This PR exposes a new global entry point for retrieving rendered HTML from the MarkEdit Preview extension, reusing the existing “save as HTML” rendering pipeline.
Changes:
- Add a
Window.__markeditPreviewGetHtml__global function type and assign it during initialization. - Refactor HTML export logic in
src/view.tsinto a reusablegenerateStaticHtml(styled)function. - Update the save-to-file flow to call the new shared generator.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| types/global.d.ts | Adds a global __markeditPreviewGetHtml__ function type on window. |
| src/view.ts | Extracts HTML generation into generateStaticHtml() and reuses it for save/export. |
| main.ts | Wires generateStaticHtml onto window.__markeditPreviewGetHtml__ during init. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
| window.MarkEditGetHtml = generateStaticHtml; | ||
| } | ||
|
|
There was a problem hiding this comment.
window.MarkEditGetHtml is only assigned inside the else branch. If the extension/script is reloaded while __markeditPreviewInitialized__ is already true (e.g., hot reload / update in-place), this new global may never be installed, leaving it undefined at runtime. Consider assigning it unconditionally (or at least window.MarkEditGetHtml ??= generateStaticHtml) so the global is available even when setup is skipped.
| window.MarkEditGetHtml = generateStaticHtml; | |
| } | |
| } | |
| window.MarkEditGetHtml ??= generateStaticHtml; |
There was a problem hiding this comment.
@copilot Are you making things up? How is this even possible?
This function is assigned to window, how is reloading the extension removes it??
Show me an example.
|
@cyanzhong I've opened a new pull request, #78, to work on those changes. Once the pull request is ready, I'll request review from you. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
No description provided.