Skip to content

Feature: add inner text / html support#6

Open
DamChtlv wants to merge 5 commits into
happyprime:trunkfrom
DamChtlv:feature/add-inner-text-support
Open

Feature: add inner text / html support#6
DamChtlv wants to merge 5 commits into
happyprime:trunkfrom
DamChtlv:feature/add-inner-text-support

Conversation

@DamChtlv
Copy link
Copy Markdown

@DamChtlv DamChtlv commented Mar 29, 2024

Feature

This adds support for content & text attribute used by most low-level blocks (like heading, paragraph, button...) and so it keeps content inside them (some html tags are filtered, like RichText component does it).

It fixes this issue: #5 , it lacks some features still (like button link...) but still better than nothing

Test

Used this HTML gutenberg code to test the feature:

<!-- wp:heading -->
<h2 class="wp-block-heading">Default title</h2>
<!-- /wp:heading -->

<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">H3 title</h3>
<!-- /wp:heading -->

<!-- wp:paragraph -->
<p>Paragraph text</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><strong>Bold paragraph text</strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><em>Italic text</em></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><s>Strikethrough text</s></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><code>Code text</code></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><sup>Superscript text</sup></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><sub>Subscript text</sub></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><mark style="background-color:var(--wp--custom--color--primary--vert-macif)" class="has-inline-color has-contrast-color">Highlight text</mark></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><a href="#link">Link text</a></p>
<!-- /wp:paragraph -->

<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="#button-link">Button text</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->

Result

Works for both PHP formatting and JS formatting:

Before:

happyprime github io_wphtml-converter_

After:

127 0 0 1_5500_index html

@DamChtlv DamChtlv changed the title Feature: add inner text support Feature: add inner text / html support Mar 29, 2024
@DamChtlv
Copy link
Copy Markdown
Author

DamChtlv commented Mar 29, 2024

Actually, i still need to work on it to add some html support (because text formatting wont be saved, like tags: <strong>, <em>...)

@DamChtlv
Copy link
Copy Markdown
Author

Updated screenshots + description, should be good now

@jeremyfelt
Copy link
Copy Markdown
Member

Thanks @DamChtlv - I'm hoping to take a look at this soon. We've had a wild couple months. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants