Select to view content in your preferred language

Spoiler element in community posts — Replace the word "Spoiler" with script name

1472
13
01-26-2024 05:34 AM
Status: Open
Labels (1)
Bud
by
Honored Contributor

I noticed @AlfredBaldenweck used an interesting technique where a lengthy Python script was collapsed into a "Spoiler."

Source: Improved documentation for updateConnectionProperties(): workspace_factory

spoiler.gif


The user can choose to expand or collapse the spoiler to show the Python script as needed.

That seems very useful when it comes to avoiding clutter in posts. Otherwise, lengthy posts and replies are cumbersome to navigate.


Idea:

Rather than using the default "Spoiler" text, could we customize the text with a more meaningful title, such as the Python script's name? I.e. MyScript.py.

Even if we had to make that change in the HTML editor, that would still be better than the default "Spoiler" text.

For example, if I copy/paste a spoiler into a post, then HTML mode looks like this:

<div class="lia-spoiler-container"><a class="lia-spoiler-link" href="https://community.
esri.com/t5/arcgis-pro-ideas/improved-documentation-for/idc-p/1278285/highlight/true#"
rel="nofollow noopener noreferrer">Spoiler</a></div>

So it seems like it should be possible to replace Spoiler with custom text. But I'm not good enough with HTML to get that working; everything I try gets automatically stripped out when I hit save/post.


Related: Support additional HTML tags in community posts

13 Comments
JesseCloutier
Status changed to: Open

Hi @Bud@AlfredBaldenweck, and @DavidPike, after review of your points and our processes, our team has determined to change the status of this idea back to Open for now. We're uncertain if it will be applicable once the anticipated update is made to our platform later this year, but are happy to re-evaluate it at that point once we're able to operate with the system's new functionality and processes.

MErikReedAugusta

I'm kudoing this because I like the concept of the idea, but I also wonder if another option might be just to add a "title" section to the code blocks and allow them to be at least partially collapsible.

Microsoft Teams does something roughly like that that could be a good proof-of-concept/example to show the dev team.  It shows only about 8-10 lines or so initially, with a button at the bottom of the code frame to expand out the full frame to show all of the code.  It also has a title section, though the choices of spacing between the title & the language (both in the header) were... subpar, in my view.

If I remember, I'll try to take a screenshot on Monday of what I'm talking about for those who don't use Teams day-to-day.

AlfredBaldenweck

@MErikReedAugusta 

I think you have a valid point (there could be room for both options though)

Here's what Teams's code block looks like: (It's also how to run a Python 2.7 script from Python 3, assuming both are installed on your machine)

AlfredBaldenweck_0-1707745653536.png

AlfredBaldenweck_1-1707745675871.png