• Resolved irishetcher

    (@irishetcher)


    This is one that I am curious about. A lot of page builders have opted to use shortcodes in the output for page structure and layout. Gutenberg is using comment tags. We see them in the code view. Is there are reason why all this could not be output directly as HTML/<divs>?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi there again!
    Shortcodes are a bit different than the method how Gutenberg blocks store content. The HTML comments don’t show up once the block is rendered in the browser and their use reflect the human readable over machine readable.
    A detailed explanation is available in the FAQ section of the handbook.

    Thread Starter irishetcher

    (@irishetcher)

    Thanks Birgit,

    It was something I was thinking about today. As I said many page builders are using shortcodes to delineate the page structure. I am a fan of shortcodes for many use cases (interpolating values from custom fields into a block of text) but was never mad about the way they are used for layout. Seeing the comment tags I was wondering why the technology javascript/REACT just didn’t say output something like:

    <div class="wp-section>
       <div class="wp-row>
        <div class="wp-column>
         <!-- content -->
       </div>
       <div class="wp-column>
         <!-- content -->
       </div>
      </div>
    </div>

    or for Gutenberg blocks

    <div class="wp-image>
         <!-- 123.jpg -->
     </div>

    I had a quick look at the FAQ and seeing JSON files, perhaps for portability purposes, you wouldn’t want to be bringing wp-classes over to another framework if you were posting the same content in many places. But it would be neater in our WordPress only world if everything was HTML.

    I see some having issues with say a gallery being peppered with the comment tags from the Gutenberg block when they try to work in code view. Where this was much more manageable in the current view it becomes less usable in Gutenberg. I like working with Divi most of the time, just because it is nice to work with. There are days though where I also need to work in a purely HTML way.

    It might be usseful to be able to hide the comment tags for such jobs. Taking this further. Something I have wanted in the text tab of TinyMCE and surprised it wasn’t implemented years ago, is to make the code views much more like a fully immersive IDE experience. Like you see on CodePen and Codeacademy.

    They have:

    dark mode
    sytax highlighting
    respect for tab indentation
    code completion/hinting
    The option to take the code view to a bigger canvas size.

    Code mirror, recently introduced to WordPress seemed to be a step in this direction. I do see it used in the HTML block but it would be nice to see it elsewhere. And it would be a step up from the letter box format of TinyMCE, which I like, but suffered from some little handicaps.

    There is a lot of things going on in your blog post above, very interesting points of view. The architecture and foundation of the block probably won’t change, though. It’s the method of choice to store relevant information in the post_content now.

    Most of your enhancement ideas might be best discussed directly with the Gutenberg developers via GitHub. I want to encourage you to contribute your views in already happening discussions there, and create new feature requests.

    To manage expectation on Code Editor enhancements. the WYIWYG editor is the main focus of the team right now, and bug fixing compatibility and UX issues. It’s worth a try, what’s the worst that can happen, right?

    The biggest drawback from shortcode is,content lock-in. If you have a Theme and also installs a page builder and then you want to switch to a different Theme you are left with a shortcode mess and potential loss of content. Gutenberg definitely aims to make it attractive for plugin developers to move away from shortcodes.

    Divi has its own way how it will handle integration with Gutenberg. Nick Roach just published an introductory blog post

    Thread Starter irishetcher

    (@irishetcher)

    Yes if Gutenberg ultimately provides a solid foundation for page layout -> sections/rows/columns, flex or even grid, it would make a lot of sense, especially if it provided a good API for page builders to add their own bells and whistles and interfaces, which at this stage are a lot superior to what you get with Gutenberg.

    If you take this further to the Visual Builder on the front end in Divi you end up seeing that this is where you will actually find a real WYSIWYG experience. It make me wonder why Gutenberg is coy about not wanting to be a page builder. There are a lot more benefits to this than what it trying to be at the moment.

    I am sure Nick is aware of the potential but I can’t see how Gutenberg and blocks are of benefit to Divi until the right structures are added to GB. With such structure in place it would be time to ditch the shortcodes. It would be a bit of work for Elegant Themes but they would be wise to act as other vendors will.

    I remember when Apple moved from OS 9 (Classic) to OS X. They provided many ways to work with these. You could dual boot into either or you could run the OS 9 applications in the true blue environment built into OSX. Many users who were dedicated to workflows tied to OS 9 took years to adopt OS X. Personally I had no issues with OSX because I was new to computers at the time. I could see all the pain points that effected the Classic users and there were a fair amount of bugs which workarounds had to be found for. It took at least five years for Apple to get everybody on board with OS X. Thing is though, they gave users choice for those years, listened and acted on the feedback and didn’t dump OS 9 until OS X was on par with features or improved alternatives.

    This makes me wonder why forcing in Gutenberg as the de-facto default is such a wise move so early. Calling the current editor classic and making users add a plugin to disable Gutenberg has a hint of deprecation. It scares a lot of the pro and loyal users and creates a lot of anger. Granted there was some of this with the OS 9 to OS X change but nothing as heated as far as I remember.

    Let’s see what happens.

    • This reply was modified 7 years, 8 months ago by irishetcher.
    • This reply was modified 7 years, 8 months ago by irishetcher.
    Thread Starter irishetcher

    (@irishetcher)

    Thanks. Sometime in the Winter months, if we get snowed in again, I’ll have a look through the workings of custom blocks.

    Thread Starter irishetcher

    (@irishetcher)

    Hi Birgit,

    As requested, I got some time today to post some of my suggestions over on gitHub.

    If you are wondering about the context of the comment before this one, it was a reply to somebody’s spam attempt to direct me to their “How to make your own block” tutorial. I think Marius removed that one.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Why comment tags for blocks?’ is closed to new replies.