HTML term rendering

Some feedback so that you understand what others (at least me) are thinking. :slightly_smiling_face:

The first problem with this IMHO is not the existing way(s) or even new ways, it is getting others to use and understand what can currently be done. Obviously you know this but to list my current knowledge for reference as there are still many parts of SWI-Prolog I don’t know or have no experience.

  • when I started outputing data using Prolog it was with write/1 and nl/0 (which as you noted should never have been added to Prolog)

  • learned and incorporated format/2,3,

  • then portray/1

  • along the way learned and incorporated DCGs with difference list (not closed list with []) to create the terms and depending upon the output format (console, file, HTML, Cytoscape.js) will enhance as necessary. Odd thing here is that write/1 with with_output_to/2 using codes(Codes,Tail) with difference list (ref) to convert a string or atom to a difference list is quite useful but not what many would do. I can’t count how many times I search for atom_codes/3 or string_codes/3 only to remember the odd way to do it.

  • currently considering using SWISH rendering for output node/edge graphs with coloring for showing graph isomorphisms and the variations.

  • Lets not forget print_message/2 which can sit in parallel with this for printing warnings and errors

  • other hooks.

  • for the reverse of getting the custom format back into SWI-Prolog there are quasiquotations.

Granted my use of SWISH is next to nothing but the sandboxing in SWISH often kills most of what I try there, so I just don’t use it much. :slightly_frowning_face:

In working with JSON a while ago I found converting JSON into dicts (ref) for working with SWI-Prolog quite useful and for viewing JSON created by SWI-Prolog would just use tell/1,told/0 to output it to file and then use one of the many online JSON viewers (Google search) to display the JSON (usually as a copy/paste as the data was about a page or less).

Another thing I am thinking is that JSON is typically a format for transferring data and is only looked at for development or bugs. The more useful format is YAML as JSON doesn’t have comments and YAML comes in handy when wanting JSON as a configuration file with human readable comments.

For me I can solve my problems with what I currently know.

The only thing I can think of that would help you is the (Google search) of JSON viewers for ideas.