HTML-Card automatically closes open tags

Hi together,

I am running Ghost 5.51.1 on https://bitcoin-2go.de

To obtain semantically annotated FAQs, we use microdata. To make this process as easy as possible for our authors, we have generated 3 HTML snippets.

These snippets are named FAQ-1, FAQ-2, and FAQ-3.

Code for FAQ-1:

<div itemscope itemtype="https://schema.org/FAQPage">
    <div class="faq modern">
        <h2 id="faq" data-name="Häufige Fragen">Frequenty Asked Questions</h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
        <ul>
          

Code for FAQ-2:

<li class="faq-element" itemscope itemprop="mainEntity" itemtype="https://schema.org/Question">
                <input type="checkbox" checked>
                <i class="icon-arrow-circle-down-secondary"></i>
                <h3 itemprop="name">Question for FAQ</h3>
                <div itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer">
                    <div itemprop="text">
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
                    </div>
                </div>
            </li>
          

Code for FAQ-3:

        </ul>
    </div>
</div>

Since updating to the latest Ghost version, open HTML tags within an HTML snippet are automatically closed. As a consequence, our <ul> tag is automatically closed before the subsequent <li> elements can be rendered. This causes the corresponding CSS styling to no longer work.

Is a bug fix planned for this?

Thank you in advance.

Yikes. I make heavy use of the lack of tag closing. Time to test the new version, I guess!

Is this when using the beta editor or the standard editor?

It’s when using the Beta-Editor. I should have given this information in advance, sorry!

Thanks, I’ve added it to our beta issues list.

1 Like

Phew! While I can imagine that tag closing would be desirable in some situations, it would break a bunch of my stuff! :)

Thanks Kevin, I highly appreciate all the work you guys are putting into making Ghost even better!

I wasn’t seeing this five days ago, but tonight on Ghost pro, I am seeing closure of html card tags and removal of closures without opens in the same html card in the beta editor. It’s not just snippets. Any HTML card created in the new editor closes any tags within it. (It doesn’t show them in the html card in the editor, but they’re there in the published post. It also strips off closing tags without an opening in the same HTML card.

This is a breaking change for landing pages that make use of html cards to group Ghost content together.

Update: Apparently once a post is created (or edited?) in the beta editor, there’s no way to get it back to the original behavior. When I switch editors back to the original editor, new posts have the non-tag-closing behavior I expect, but posts created in the beta editor continue to exhibit it, even if I open them and edit all the HTML cards with the original editor.

I’d love to hear from the dev team about whether the plan is to automatically close tags going forward. I can see an argument for that, BUT it’s going to completely break two fairly large Ghost projects I did for clients this year that relied on the current behavior. I’m hoping this is unintended - I don’t see it in the patch notes.

I too utilise this methodology. For example, sometimes I have image card-inserted images that have white backgrounds (such as charts), and as I don’t want them to float on a white background (which they don’t do in dark mode) before the image card I add a snippet that has an opening div with a specific class (which adds a border), then after the image card I add in the closing div with another HTML card. I have other examples like this which I sometimes use to tweak image cards and such.

1 Like

Exactly! Incredibly useful. I could get by without it if there were a generic and nestable “put these elements in a Div with this class” function in the editor, but without it? Uh-uh

1 Like

This was a bug, it’s been fixed in main and will be included in the next patch release. The intention with the beta editor is to have parity with the existing editor so anything like this is a bug and not intentional - please keep letting us know when you see any differences! :pray:

2 Likes

That’s expected. The original and beta editors are mutually exclusive, you can’t edit a post created in one with the other, each post will load the appropriate editor when you open it whether or not you still have the beta checkbox enabled - the checkbox is there to enable the beta editor for new posts.

Awesome, thank you!

I didn’t figure out that the post content as actually stored in a different format by the new editor until later yesterday. :) At which point the editor behavior made more sense. But that led to my next question, which is will mobiledoc support be going away. I’m currently writing something that pushes post/page content over to Ghost in mobiledoc format, and if that’s going away, I need to figure out my next plan… Dev team question: What's the future of Mobiledoc?

I have answered on the Mobiledoc thread :)

Very pleased to be able to confirm that it’s fixed! :) Huzzah and happy dance!

And now, back to making Ghost pages do things they weren’t exactly intended to do. After I teach myself Lexical.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.