TiddlyWiki / TiddlyWiki5

A self-contained JavaScript wiki for the browser, Node.js, AWS Lambda etc.
https://tiddlywiki.com/
Other
7.97k stars 1.18k forks source link

widget documentation: codeblock.js, edit-binary.js, element.js, entity.js #1985

Closed tobibeer closed 9 months ago

tobibeer commented 8 years ago

These widgets are part of the core whereas there appears to be no documentation on TiddlyWiki.com or prerelease for them yet.

tgrosinger commented 8 years ago

edit-binary.js seems to just be a place holder that shows a warning message. Am I missing something? I couldn't find any uses of it.

tgrosinger commented 8 years ago

I am reading through entity.js and it seems that it should allow you to render an html escape sequence, however I am having trouble getting it to work.

This works as expected, rendering the cent sign

$tw.utils.entityDecode("¢")

However, when trying to use the actual widget I am unable to get it to pass the correct value into the entityDecode function. I've tried these variations:

<$entity>&cent;</$entity>

<$entity entity="&cent;" />

Both result in Cannot read property 'substr' of undefined due to undefined being passed to the entityDecode function.

tobibeer commented 8 years ago

Not entirely sure, but the reason why these widgets are not documented yet is possibly because they have so far been solely used by the core to provide basic components to handle things like plain html within wikitext. So, while part of the api, they're perhaps not quite seen as general purpose widgets to do stuff with. On the other hand, for completeness sake, I think it makes sense to have them documented as to what they do and how they work.

@Jermolene, I also couldn't figure out how to make the entity widget work when entered into wikitext... and, it's perhaps worth investigation what produces the js error... so as to capture these things.

Jermolene commented 8 years ago

The "entity" widget accepts the "entity" parameter through the parse tree, not as a conventional attribute. It could be updated to look for an attribute and then fall-back to the parse tree parameter, as some other widgets do.

Not entirely sure, but the reason why these widgets are not documented yet is possibly because they have so far been solely used by the core to provide basic components to handle things like plain html within wikitext

That's roughly correct, the three widgets edit-binary.js, element.js, entity.js aren't really very useful outside the core rendering process.

tobibeer commented 8 years ago

Perhaps any basic documentation on tiddlywiki.com for these widgets could transclude a basic summary about he parsetree mechanism and maybe point to...

http://tiddlywiki.com/dev/#Parser

pmario commented 9 months ago

Did not find anything about edit-binary

@Jermolene -- Should we keep this one open?

Jermolene commented 9 months ago

Thank you @pmario

The "element" widget is an implementation detail and I think serves no useful purpose for end users.

The "edit-binary" widget is an implementation detail of the <$edit> widget isn't very useful on its own, and so I think it is reasonable not to clutter up the docs with it.