this post was submitted on 26 Jul 2024
2 points (100.0% liked)

Perchance - Create a Random Text Generator

448 readers
15 users here now

⚄︎ Perchance

This is a Lemmy Community for perchance.org, a platform for sharing and creating random text generators.

Feel free to ask for help, share your generators, and start friendly discussions at your leisure :)

This community is mainly for discussions between those who are building generators. For discussions about using generators, especially the popular AI ones, the community-led Casual Perchance forum is likely a more appropriate venue.

See this post for the Complete Guide to Posting Here on the Community!

Rules

1. Please follow the Lemmy.World instance rules.

2. Be kind and friendly.

  • Please be kind to others on this community (and also in general), and remember that for many people Perchance is their first experience with coding. We have members for whom English is not their first language, so please be take that into account too :)

3. Be thankful to those who try to help you.

  • If you ask a question and someone has made a effort to help you out, please remember to be thankful! Even if they don't manage to help you solve your problem - remember that they're spending time out of their day to try to help a stranger :)

4. Only post about stuff related to perchance.

  • Please only post about perchance related stuff like generators on it, bugs, and the site.

5. Refrain from requesting Prompts for the AI Tools.

  • We would like to ask to refrain from posting here needing help specifically with prompting/achieving certain results with the AI plugins (text-to-image-plugin and ai-text-plugin) e.g. "What is the good prompt for X?", "How to achieve X with Y generator?"
  • See Perchance AI FAQ for FAQ about the AI tools.
  • You can ask for help with prompting at the 'sister' community Casual Perchance, which is for more casual discussions.
  • We will still be helping/answering questions about the plugins as long as it is related to building generators with them.

6. Search through the Community Before Posting.

  • Please Search through the Community Posts here (and on Reddit) before posting to see if what you will post has similar post/already been posted.

founded 1 year ago
MODERATORS
 

This is frustrating when making certain kinds of plugins. For example, you want to pass in some HTML, but you can't because perchance decides the block isn't code anymore.

Ideally, all code within a [code block] would be ignored until its final ].

Oh while I'm on the topic... Please ignore any [] or {} inside of <script> tags or in things like onclick="" attributes. Would make life a lot easier ;p

you are viewing a single comment's thread
view the rest of the comments
[–] wthit56 1 points 3 months ago (4 children)

Wow okay that's bizarre! So it turns < etc. into regular characters before passing it to the function or something? Where is any of this documented?! 😂

That is not how these things work normally; < will show just that character in the HTML document. The fact it doesn't do that if you use it in code to pass as a string to a function which then returns it... just to get around this breaking-code-blocks behaviour is... just out of this world 😅

There's so much going on with this engine under the hood that if you actually have any understanding of real, regular JS... it drives you insane 🥴

Okay at least that's a workaround. But seriously... it should just ignore stuff in [code blocks] entirely so you don't have to have all this deep knowledge and you don't have to go insane trying to understand it.

[–] perchance 3 points 3 months ago* (last edited 3 months ago) (3 children)

if you actually have any understanding of real, regular JS… it drives you insane [...] But seriously… it should just ignore stuff in [code blocks] entirely so you don’t have to have all this deep knowledge and you don’t have to go insane trying to understand it.

I agree 100% - at some point I'll fix all these issues. I'd like it to be a very thin/robust/predictable layer on top of raw web platform stuff.

Where is any of this documented?!

https://perchance.org/known-bugs which is linked from https://perchance.org/resources but I agree it's not very easy to find, and these issues obviously ideally wouldn't exist in the first place.

So it turns < etc. into regular characters before passing it to the function or something?

The problem here (and the way to mentally model this - CC @[email protected]) is that the output HTML is fully rendered without any Perchance-specific stuff first (i.e. just setting innerHTML), and then the square blocks are evaluated in any text nodes on the page. So the underlying issue is the same for your original request, and this question about < and &lt;. I'll add this explanation to the existing item for this on /known-bugs page. I guess the simple way of explaining it is "HTML parsing gets priority".

But I agree it shouldn't. So yeah it's a silly bug, and the only reason I haven't fixed it is because it'd be a breaking change, and so requires a manifest/versioning type thing to be added as a header HTML comment to existing generators which are relying on this ~bug.

Thanks for bringing up the issue though - it's nice to have fresh eyes on this stuff, and hearing complaints helps me prioritize.

[–] wthit56 1 points 3 months ago (2 children)

Oh, I see... I guess that's why it works out like that. Thanks for explaining.

I kind of enjoy this stuff. For a number of years I was part of a somewhat niche community for another user-creation platform for video games called Dreams. I taught, helped, answered questions, and wrote my own documentation just through reverse-engineering stuff within the engine.

I've already started on one for perchance, just explaining the methods/properties on list nodes. thinking of doing more, but some of this stuff is quite hard to figure out by myself--and a lot of it just isn't explicitly explained anywhere.

Dreams had the same issue: great software with really deep features that no one but the devs understood or knew existed. So I'd scour their streams for clues to such features, then explore them fully in the engine to get as accurate a picture of it as I could--then added it to my documentation.

Hard work, but I seem to just enjoy stuff like that. ;p

[–] VioneT 1 points 3 months ago (1 children)

I've also made some tutorials/articles on some parts of Perchance. They are available on the Learn Tab of the /hub.

I think the most useful and less wordy that I made is: Perchance Snippets.

[–] wthit56 1 points 3 months ago

Nice--I'll check those out too 👍