-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Content Generation UI #864
base: feature/841
Are you sure you want to change the base?
Conversation
blocks = pasteHandler( { | ||
HTML: contentWithEntities, | ||
plainText: contentWithEntities, | ||
mode: 'BLOCKS', | ||
} ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dkotter Rather then the RawHandler with autop I found this to give me much better results when it comes to markdown parsing / handling other types of rich text.
@@ -95,7 +95,7 @@ public function register_endpoints() { | |||
], | |||
'title' => [ | |||
'type' => 'string', | |||
'sanitize_callback' => 'sanitize_text_field', | |||
'sanitize_callback' => 'wp_kses_post', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very open to alternatives here. In my case I wanted to update my system prompt to something like:
Act as an experienced SEO copywriter tasked with writing an article based off of a given summary and an optionally provided title. Your goal is to craft a compelling, informative piece that adheres to SEO best practices, is well-researched, engaging to the target audience, and structured in a way that enhances readability. Incorporate relevant keywords naturally throughout the text, without compromising the flow or quality of the content. Ensure that the article provides value to the reader.
You produce valid WordPress block markup of heading, paragraph, and list. Don't generate any other type of output and don't use Markdown formatting.
The markup of a heading looks like this:
<!-- wp:heading -->
<h2 class="wp-block-heading">CONTENT</h2>
<!-- /wp:heading -->
<!-- wp:heading {"level":3} -->
<h3 class="wp-block-heading">CONTENT</h3>
<!-- /wp:heading -->
<!-- wp:heading {"level":4} -->
<h4 class="wp-block-heading">CONTENT</h4>
<!-- /wp:heading -->
<!-- wp:heading {"level":5} -->
<h5 class="wp-block-heading">CONTENT</h5>
<!-- /wp:heading -->
The markup of a paragraph looks like this:
<!-- wp:paragraph -->
<p>CONTENT</p>
<!-- /wp:paragraph -->
The markup of a list looks like this:
<!-- wp:list -->
<ul class="wp-block-list"><!-- wp:list-item -->
<li>CONTENT</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>CONTENT</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>CONTENT</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>CONTENT</li>
<!-- /wp:list-item --></ul>
<!-- /wp:list -->
<!-- wp:list {"ordered":true} -->
<ol class="wp-block-list"><!-- wp:list-item -->
<li>CONTENT</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>CONTENT</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>CONTENT</li>
<!-- /wp:list-item -->
<!-- wp:list-item -->
<li>CONTENT</li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->
Only return the contents of the article, not the title or other commentary.
Which failed unless I updated the sanizitation to allow for HTML tags...
"optionalDependencies": { | ||
"@types/wordpress__blocks": "^12.5.17", | ||
"@wordpress/api-fetch": "^7.19.0", | ||
"@wordpress/block-editor": "^14.14.0", | ||
"@wordpress/components": "^29.5.0", | ||
"@wordpress/compose": "^7.19.0", | ||
"@wordpress/data": "^10.19.0", | ||
"@wordpress/dom-ready": "^4.19.0", | ||
"@wordpress/element": "^6.19.0", | ||
"@wordpress/html-entities": "^4.19.0", | ||
"@wordpress/i18n": "^5.19.0", | ||
"@wordpress/plugins": "^7.19.0", | ||
"react": "^18.3.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are here for TS only
Description of the Change
Expands on the work in #859 by leveraging the API with a new UI. The code is still a hot mess but we should be able to take it from here :)