• Hi,

    I just found that the original plugin from which yours is forked, has been closed recently. Since it’s a fork, I though I could probably switch plugins, but unfortunately that causes existing code blocks to be invalid and a recovery attempt fails.

    Do you think there is an easy fix for that? I’d prefer to use a plugin that’s in active development, but loosing over 400 code blocks isn’t an option, unfortunately.

    Thanks
    JP

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    While my plugin is a fork, the codebase is basically a complete rewrite. My approach was to extend the Code block in core rather than to introduce a new block, so if you can somehow convert all of your blocks into core’s Code block then this plugin could be used instead.

    I suppose my plugin could try to add a facility to migrate blocks from that other plugin over to Code blocks, but I don’t have much time to investigate that right now.

    Thank you for your reply.

    The other plugin also build on top of the code block from core. It only adds a ‘lang’ and ‘class’ element to the <code> tag.

    This is the html in the revision history of a core code block without the other plugin.

    <!-- wp:code -->
    <pre class="wp-block-code"><code>This is code</code></pre>
    <!-- /wp:code -->

    This is the same with the other plugin with the code language set to CSS

    <!-- wp:code -->
    <pre class="wp-block-code"><code lang="css" class="language-css">This is code</code></pre>
    <!-- /wp:code -->

    And this is your plugin with the code language set to CSS

    <!-- wp:code {"language":"css"} -->
    <pre class="wp-block-code"><code>This is code</code></pre>
    <!-- /wp:code -->

    I see that the other plugin adds the extra settings into the <code>element, while your plugin adds them into the <!– wp:code –> line.

    It looks like your method is the correct method, because the blocks remain valid when I disable your plugin, while they become invalid when I disable the other plugin.

    I’ll see if I can make a database query to replace <code anything> with just <code>.

    Does you plugin have a setting to change the color schema to black background? The other one has a an option in settings » Code Syntax Block.

    Thanks
    JP

    Plugin Author Weston Ruter

    (@westonruter)

    Yea, you can change the color scheme. This is exposed in the Customizer, which isn’t the most discoverable way to do so anymore, I recognize.

    You can also set the color scheme programmatically: https://github.com/westonruter/syntax-highlighting-code-block/wiki/Advanced-Usage#specifying-the-styles

    Thanks, I switched.

    Removing the excessive code from the old plugin from the database went pretty smooth.

    The customizer link isn’t available in the backend when using the Twenty Twenty-Five theme, but I could still get there by going to https://mydomain.com/wp-admin/customize.php.

    It would be nice to also have toggles there for wrapLines and showLineNumbers 🙂

    Thanks you for your help!
    JP

    Plugin Author Weston Ruter

    (@westonruter)

    There’s an issue open for improving discoverability of the settings without relying on the Customizer: https://github.com/westonruter/syntax-highlighting-code-block/issues/253

    That will likely entail a larger effort by also adding live previews in the editor itself: https://github.com/westonruter/syntax-highlighting-code-block/issues/8

    And yes, it would be nice if there were checkboxes for highlighting lines, but actually there is another option now in that the Code block in core supports inline formatting. This isn’t supported yet in this plugin, but ideally you could add links to bits of code and highlights using the core UI and then also get the syntax highlighting. Issue: https://github.com/westonruter/syntax-highlighting-code-block/issues/205

    Thanks, good to know.

    I didn’t mean checkboxes for highlighting lines. I mean having toggles or checkbox in the customizer to enable line numbers and line wrapping by default, which currently needs to be done with a small plugin as you suggest here. I did it that way, but it’s easier to have a toggle somewhere in the settings. Lot’s of nice features that, unfortunately, are hidden.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.