HTML Documents Extension - #628
Conversation
❌ Preview build failedFailed on |
|
But you were right about the Python extension it didnt really add anything new. I think this does add more features that that does. I'm checking right now to see if something like this already exists but i'm pretty sure it isn't |
I see you had added a block that helps to scale appropriately (id |
|
Could you make it so that multiple pages can be displayed at once? |
Steve0Greatness
left a comment
There was a problem hiding this comment.
A bit more of a general concern, but you should put this through Prettier, because this is formatted, in my opinion, a bit badly.
|
thanks for the feedback! i'll get to it. |
Well, there's Project Interfaces, which is a similar idea, but it doesn't allow for the creation of documents made up of HTML. |
|
i was thinking about that exact thing while i was making this. I wanted to give users more control and the ability to display and build their own webpage documents. |
|
can i use 'https://unpkg.com/html-dom-parser@latest/dist/html-dom-parser.min.js' for prettier |
|
or i can use this function function prettierInText(html) {
// Clean up existing whitespace and collapse it
let clean = html.replace(/\s*([<>])\s*/g, '$1').replace(/\s+/g, ' ');
let reg = /(<[^>]+>)/g;
let matches = clean.split(reg).filter(Boolean);
let formatted = '';
let pad = 0;
matches.forEach((token) => {
// Check if the token is a closing tag
if (token.match( /<\/\w+/ )) {
pad--;
}
// Add current line indentation
formatted += ' '.repeat(Math.max(0, pad)) + token + '\n';
// Check if the token is an opening tag (and not self-closing)
if (token.match( /<[^\/][^>]*[^>\/]>/ ) && !token.match(/<(input|img|br|hr|meta|link)/)) {
pad++;
}
});
return formatted.trim();
}
// Example Usage
const raw = '<div><h1>Title</h1><p>Text</p><img src="img.jpg"/></div>';
console.log(prettierInText(raw)); |
This seems to be very clearly AI generated. I don't know if you vibecoded this extension but if you did that's a biiiig no-no |
|
I typed this myself. But the function i just pasted was AI generated because I wanted to see if you would or would not want me to import the prettier. |
|
I don't paln on using the script I sent you but I want to verify if i'm ok to import perttier from https://unpkg.com/html-dom-parser@latest/dist/html-dom-parser.min.js' |
I built this off of my previous html to canvas extension that I made last year. |
Uh, I don't think that's Prettier, that's a DOM parser. Prettier is a code formatter, I was requesting that you reformat your code. |
|
OH. ok. it does have a html parser. You wnated me to format my code |
Yes. The JavaScript of the extension, that's what I want you to format. |
|
I'll do that when i post my new revided version that replies to your suggestions (I'm a good coder but a horrible formatter. I'm downloading prettier on vscode right now) |
Alright, you actually don't need to open a new PR, just push to the same branch that this PR is pulling from (main). |
|
Additionally, you can just use the builtin |
|
I got you. |
|
should i use that to insert elements into my iframe or change the entire this.pages[page].codeto a HTML DOM |
Added documentation for creating HTML webpages.
Expanded documentation for HTML document manipulation commands, including creation, display, and styling of pages and elements.
|
all changes made |
|
if you could please fix the merge conflicts github lists that would be perfect |
|
your custom types need serialization/deserialization support or projects may not be able to safe if for example a custom type is stored inside a variable |
Can i make a new PR? this one has too many commits anyway. |
I'll get on it |
|
ill finish the serilizzaton by the end of the week |
|
added |
|
hello? |
sorry about that |
|
done |


Create HTML webpages and display them on the stage

I'll make a documentation when I know what you think of this