From b57adbda4139981d636bc238a9c31ab986cf52b6 Mon Sep 17 00:00:00 2001 From: Marcus Kazmierczak Date: Wed, 3 Nov 2021 10:39:44 -0700 Subject: [PATCH 1/7] Add automated core blocks documentation - Creates a new script to generate core-blocks document - Lists all core blocks with supports, attributes - Add to build process --- bin/api-docs/gen-block-lib-list.js | 137 +++++ docs/manifest.json | 6 + docs/reference-guides/core-blocks.md | 763 +++++++++++++++++++++++++++ docs/toc.json | 1 + package.json | 2 +- 5 files changed, 908 insertions(+), 1 deletion(-) create mode 100644 bin/api-docs/gen-block-lib-list.js create mode 100644 docs/reference-guides/core-blocks.md diff --git a/bin/api-docs/gen-block-lib-list.js b/bin/api-docs/gen-block-lib-list.js new file mode 100644 index 0000000000000..8426be278070c --- /dev/null +++ b/bin/api-docs/gen-block-lib-list.js @@ -0,0 +1,137 @@ +/** + * External dependencies + */ +const { resolve } = require( 'path' ); +const glob = require( 'fast-glob' ); +const fs = require( 'fs' ); +const { keys, pickBy } = require( 'lodash' ); +/** + * Path to root project directory. + * + * @type {string} + */ +const ROOT_DIR = resolve( __dirname, '../..' ); + +/** + * Path to packages directory. + * + * @type {string} + */ +const BLOCK_LIBRARY_DIR = resolve( ROOT_DIR, 'packages/block-library/src' ); + +/** + * Path to docs file. + * + * @type {string} + */ +const BLOCK_LIBRARY_DOCS_FILE = resolve( + ROOT_DIR, + 'docs/reference-guides/core-blocks.md' +); + +/** + * Start token for matching string in doc file. + * + * @type {string} + */ +const START_TOKEN = ''; + +/** + * Start token for matching string in doc file. + * + * @type {string} + */ +const END_TOKEN = ''; + +/** + * Regular expression using tokens for matching in doc file. + * Note: `.` does not match new lines, so [^] is used. + * + * @type {RegExp} + */ +const TOKEN_PATTERN = new RegExp( START_TOKEN + '[^]*' + END_TOKEN ); + +/** + * Uses lodash keys and pickby to get keys with truthy values, + * filtering out any experimental keys. + * + * @type {Object} obj + * @return {string[]} Array of truthy keys + */ +function getTruthyKeys( obj ) { + return keys( pickBy( obj ) ).filter( + ( key ) => ! key.startsWith( '__exp' ) + ); +} + +/** + * Process list of object that may contain inner keys. + * For example: spacing( margin, padding ). + * + * @param {Object} obj + * @return {string[]} Array of keys (inner keys) + */ +function processObjWithInnerKeys( obj ) { + const rtn = []; + + const kvs = getTruthyKeys( obj ); + + kvs.forEach( ( key ) => { + if ( Array.isArray( obj[ key ] ) ) { + rtn.push( `${ key } (${ obj[ key ].sort().join( ', ' ) })` ); + } else if ( typeof obj[ key ] === 'object' ) { + const innerKeys = getTruthyKeys( obj[ key ] ); + rtn.push( `${ key } (${ innerKeys.sort().join( ', ' ) })` ); + } else { + rtn.push( key ); + } + } ); + return rtn; +} + +/** + * Reads block.json file and returns markdown formatted entry. + * + * @param {string} filename + * + * @return {string} markdown + */ +function readBlockJSON( filename ) { + const data = fs.readFileSync( filename, 'utf8' ); + const blockjson = JSON.parse( data ); + + const supports = processObjWithInnerKeys( blockjson.supports ); + const attributes = getTruthyKeys( blockjson.attributes ); + + return ` +## ${ blockjson.title } + +${ blockjson.description } + +- **Name:** ${ blockjson.name } +- **Category:** ${ blockjson.category } +- **Supports:** ${ supports.sort().join( ', ' ) } +- **Attributes:** ${ attributes.sort().join( ', ' ) } +`; +} + +// Generate block docs +const files = glob.sync( `${ BLOCK_LIBRARY_DIR }/*/block.json` ); +let autogen = ''; + +files.forEach( ( file ) => { + const markup = readBlockJSON( file ); + autogen += markup; +} ); + +let docsContent = fs.readFileSync( BLOCK_LIBRARY_DOCS_FILE, { + encoding: 'utf8', + flag: 'r', +} ); + +// Add delimiters back. +autogen = START_TOKEN + '\n' + autogen + '\n' + END_TOKEN; +docsContent = docsContent.replace( TOKEN_PATTERN, autogen ); + +// write back out +fs.writeFileSync( BLOCK_LIBRARY_DOCS_FILE, docsContent, { encoding: 'utf8' } ); diff --git a/docs/manifest.json b/docs/manifest.json index ae6249b7fe724..0581a58e0fdbd 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -485,6 +485,12 @@ "markdown_source": "../docs/reference-guides/block-api/block-variations.md", "parent": "block-api" }, + { + "title": "Core Blocks Reference", + "slug": "core-blocks", + "markdown_source": "../docs/reference-guides/core-blocks.md", + "parent": "reference-guides" + }, { "title": "Filter Reference", "slug": "filters", diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md new file mode 100644 index 0000000000000..dd8f09ab3dc69 --- /dev/null +++ b/docs/reference-guides/core-blocks.md @@ -0,0 +1,763 @@ +# Core Blocks Reference + +This page lists the core blocks included in the block-library package. + + + +## Archives + +Display a monthly archive of your posts. + +- **Name:** core/archives +- **Category:** widgets +- **Supports:** align +- **Attributes:** displayAsDropdown, showPostCounts + +## Audio + +Embed a simple audio player. + +- **Name:** core/audio +- **Category:** media +- **Supports:** align, anchor +- **Attributes:** autoplay, caption, id, loop, preload, src + +## Reusable block + +Create and save content to reuse across your site. Update the block, and the changes apply everywhere it’s used. + +- **Name:** core/block +- **Category:** reusable +- **Supports:** +- **Attributes:** ref + +## Button + +Prompt visitors to take action with a button-style link. + +- **Name:** core/button +- **Category:** design +- **Supports:** align, anchor, color (gradients), spacing (padding), typography (fontSize) +- **Attributes:** backgroundColor, gradient, linkTarget, placeholder, rel, text, textColor, title, url, width + +## Buttons + +Prompt visitors to take action with a group of button-style links. + +- **Name:** core/buttons +- **Category:** design +- **Supports:** align (full, wide), anchor, spacing (blockGap, margin) +- **Attributes:** + +## Calendar + +A calendar of your site’s posts. + +- **Name:** core/calendar +- **Category:** widgets +- **Supports:** align +- **Attributes:** month, year + +## Categories + +Display a list of all categories. + +- **Name:** core/categories +- **Category:** widgets +- **Supports:** align +- **Attributes:** displayAsDropdown, showHierarchy, showOnlyTopLevel, showPostCounts + +## Code + +Display code snippets that respect your spacing and tabs. + +- **Name:** core/code +- **Category:** text +- **Supports:** anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** content + +## Column + +A single column within a columns block. + +- **Name:** core/column +- **Category:** text +- **Supports:** anchor, color (gradients, link), spacing (padding) +- **Attributes:** allowedBlocks, templateLock, verticalAlignment, width + +## Columns + +Display content in multiple columns, with blocks added to each column. + +- **Name:** core/columns +- **Category:** design +- **Supports:** align (full, wide), anchor, color (gradients, link), spacing (blockGap, margin, padding) +- **Attributes:** isStackedOnMobile, verticalAlignment + +## Comment Author Avatar + +Add the avatar of this comment's author. + +- **Name:** core/comment-author-avatar +- **Category:** theme +- **Supports:** color (background) +- **Attributes:** height, width + +## Comment Author Name + +Add the author name of this comment. + +- **Name:** core/comment-author-name +- **Category:** theme +- **Supports:** color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** isLink, linkTarget, textAlign + +## Comment Content + +Displays the contents of a comment. + +- **Name:** core/comment-content +- **Category:** theme +- **Supports:** color (gradients, link), spacing (padding), typography (fontSize, lineHeight) +- **Attributes:** textAlign + +## Comment Date + +Add the date of this comment. + +- **Name:** core/comment-date +- **Category:** theme +- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Attributes:** format, isLink + +## Comment Edit Link + +Displays a link to edit the comment in the WordPress Dashboard. This link is only visible to users with the edit comment capability. + +- **Name:** core/comment-edit-link +- **Category:** theme +- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Attributes:** linkTarget, textAlign + +## Comment Reply Link + +Displays a link to reply to a comment. + +- **Name:** core/comment-reply-link +- **Category:** theme +- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Attributes:** textAlign + +## Comment Template + +Contains the block elements used to render a comment, like the title, date, author, avatar and more. + +- **Name:** core/comment-template +- **Category:** design +- **Supports:** align +- **Attributes:** + +## Comments Query Loop + +An advanced block that allows displaying post comments based on different query parameters and visual configurations. + +- **Name:** core/comments-query-loop +- **Category:** theme +- **Supports:** align (full, wide), color (gradients, link) +- **Attributes:** queryId, queryPerPage, tagName + +## Cover + +Add an image or video with a text overlay — great for headers. + +- **Name:** core/cover +- **Category:** media +- **Supports:** align, anchor, color (), spacing (padding) +- **Attributes:** allowedBlocks, alt, backgroundType, contentPosition, customGradient, customOverlayColor, dimRatio, focalPoint, gradient, hasParallax, id, isDark, isRepeated, minHeight, minHeightUnit, overlayColor, templateLock, url + +## Embed + +Add a block that displays content pulled from other sites, like Twitter or YouTube. + +- **Name:** core/embed +- **Category:** embed +- **Supports:** align +- **Attributes:** allowResponsive, caption, previewable, providerNameSlug, responsive, type, url + +## File + +Add a link to a downloadable file. + +- **Name:** core/file +- **Category:** media +- **Supports:** align, anchor +- **Attributes:** displayPreview, downloadButtonText, fileId, fileName, href, id, previewHeight, showDownloadButton, textLinkHref, textLinkTarget + +## Classic + +Use the classic WordPress editor. + +- **Name:** core/freeform +- **Category:** text +- **Supports:** +- **Attributes:** content + +## Gallery + +Display multiple images in a rich gallery. + +- **Name:** core/gallery +- **Category:** media +- **Supports:** align, anchor +- **Attributes:** allowResize, caption, columns, fixedHeight, ids, imageCrop, images, linkTarget, linkTo, shortCodeTransforms, sizeSlug + +## Group + +Combine blocks into a group. + +- **Name:** core/group +- **Category:** design +- **Supports:** align (full, wide), anchor, color (gradients, link), spacing (padding) +- **Attributes:** tagName, templateLock + +## Heading + +Introduce new sections and organize content to help visitors (and search engines) understand the structure of your content. + +- **Name:** core/heading +- **Category:** text +- **Supports:** __unstablePasteTextInline, align (full, wide), anchor, color (link), spacing (margin), typography (fontSize, lineHeight) +- **Attributes:** content, level, placeholder, textAlign + +## Home Link + +Create a link that always points to the homepage of the site. Usually not necessary if there is already a site title link present in the header. + +- **Name:** core/home-link +- **Category:** design +- **Supports:** +- **Attributes:** label + +## Custom HTML + +Add custom HTML code and preview it as you edit. + +- **Name:** core/html +- **Category:** widgets +- **Supports:** +- **Attributes:** content + +## Image + +Insert an image to make a visual statement. + +- **Name:** core/image +- **Category:** media +- **Supports:** anchor, color () +- **Attributes:** align, alt, caption, height, href, id, linkClass, linkDestination, linkTarget, rel, sizeSlug, title, url, width + +## Latest Comments + +Display a list of your most recent comments. + +- **Name:** core/latest-comments +- **Category:** widgets +- **Supports:** align +- **Attributes:** commentsToShow, displayAvatar, displayDate, displayExcerpt + +## Latest Posts + +Display a list of your most recent posts. + +- **Name:** core/latest-posts +- **Category:** widgets +- **Supports:** align +- **Attributes:** addLinkToFeaturedImage, categories, columns, displayAuthor, displayFeaturedImage, displayPostContent, displayPostContentRadio, displayPostDate, excerptLength, featuredImageAlign, featuredImageSizeHeight, featuredImageSizeSlug, featuredImageSizeWidth, order, orderBy, postLayout, postsToShow, selectedAuthor + +## List + +Create a bulleted or numbered list. + +- **Name:** core/list +- **Category:** text +- **Supports:** __unstablePasteTextInline, anchor, color (gradients, link), typography (fontSize, lineHeight) +- **Attributes:** ordered, placeholder, reversed, start, type, values + +## Login/out + +Show login & logout links. + +- **Name:** core/loginout +- **Category:** theme +- **Supports:** className, typography () +- **Attributes:** displayLoginAsForm, redirectToCurrent + +## Media & Text + +Set media and words side-by-side for a richer layout. + +- **Name:** core/media-text +- **Category:** media +- **Supports:** align (full, wide), anchor, color (gradients, link) +- **Attributes:** align, focalPoint, href, imageFill, isStackedOnMobile, linkClass, linkDestination, linkTarget, mediaAlt, mediaId, mediaLink, mediaPosition, mediaSizeSlug, mediaType, mediaUrl, mediaWidth, rel, verticalAlignment + +## Unsupported + +Your site doesn’t include support for this block. + +- **Name:** core/missing +- **Category:** text +- **Supports:** +- **Attributes:** originalContent, originalName, originalUndelimitedContent + +## More + +Content before this block will be shown in the excerpt on your archives page. + +- **Name:** core/more +- **Category:** design +- **Supports:** +- **Attributes:** customText, noTeaser + +## Navigation + +A collection of blocks that allow visitors to get around your site. + +- **Name:** core/navigation +- **Category:** theme +- **Supports:** align (full, wide), anchor, inserter, spacing (blockGap, units), typography (fontSize, lineHeight) +- **Attributes:** __unstableLocation, backgroundColor, customBackgroundColor, customOverlayBackgroundColor, customOverlayTextColor, customTextColor, navigationMenuId, openSubmenusOnClick, overlayBackgroundColor, overlayMenu, overlayTextColor, rgbBackgroundColor, rgbTextColor, showSubmenuIcon, textColor + +## Navigation Area + +Define a navigation area for your theme. The navigation block associated with this area will be automatically displayed. + +- **Name:** core/navigation-area +- **Category:** theme +- **Supports:** inserter +- **Attributes:** area + +## Custom Link + +Add a page, link, or another item to your navigation. + +- **Name:** core/navigation-link +- **Category:** design +- **Supports:** +- **Attributes:** description, id, isTopLevelLink, kind, label, opensInNewTab, rel, title, type, url + +## Submenu + +Add a submenu to your navigation. + +- **Name:** core/navigation-submenu +- **Category:** design +- **Supports:** +- **Attributes:** description, id, isTopLevelItem, kind, label, opensInNewTab, rel, title, type, url + +## Page Break + +Separate your content into a multi-page experience. + +- **Name:** core/nextpage +- **Category:** design +- **Supports:** +- **Attributes:** + +## Page List + +Display a list of all pages. + +- **Name:** core/page-list +- **Category:** widgets +- **Supports:** +- **Attributes:** + +## Paragraph + +Start with the building block of all narrative. + +- **Name:** core/paragraph +- **Category:** text +- **Supports:** __unstablePasteTextInline, anchor, color (link), typography (fontSize, lineHeight) +- **Attributes:** align, content, direction, dropCap, placeholder + +## Pattern + +Show a block pattern. + +- **Name:** core/pattern +- **Category:** design +- **Supports:** +- **Attributes:** slug + +## Post Author + +Add the author of this post. + +- **Name:** core/post-author +- **Category:** theme +- **Supports:** color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** avatarSize, byline, showAvatar, showBio, textAlign + +## Post Comment (deprecated) + +This block is deprecated. Please use the Comments Query Loop block instead. + +- **Name:** core/post-comment +- **Category:** theme +- **Supports:** +- **Attributes:** commentId + +## Post Comments + +Display a post's comments. + +- **Name:** core/post-comments +- **Category:** theme +- **Supports:** align (full, wide), color (gradients, link), typography (fontSize, lineHeight) +- **Attributes:** textAlign + +## Post Comments Count + +Display a post's comments count. + +- **Name:** core/post-comments-count +- **Category:** theme +- **Supports:** color (gradients), typography (fontSize, lineHeight) +- **Attributes:** textAlign + +## Post Comments Form + +Display a post's comments form. + +- **Name:** core/post-comments-form +- **Category:** theme +- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Attributes:** textAlign + +## Post Comments Link + +Displays the link to the current post comments. + +- **Name:** core/post-comments-link +- **Category:** theme +- **Supports:** color (link), typography (fontSize, lineHeight) +- **Attributes:** textAlign + +## Post Content + +Displays the contents of a post or page. + +- **Name:** core/post-content +- **Category:** theme +- **Supports:** align (full, wide) +- **Attributes:** + +## Post Date + +Add the date of this post. + +- **Name:** core/post-date +- **Category:** theme +- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Attributes:** format, isLink, textAlign + +## Post Excerpt + +Display a post's excerpt. + +- **Name:** core/post-excerpt +- **Category:** theme +- **Supports:** color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** moreText, showMoreOnNewLine, textAlign + +## Post Featured Image + +Display a post's featured image. + +- **Name:** core/post-featured-image +- **Category:** theme +- **Supports:** align (center, full, left, right, wide), color (), spacing (margin, padding) +- **Attributes:** height, isLink, scale, width + +## Post Navigation Link + +Displays the next or previous post link that is adjacent to the current post. + +- **Name:** core/post-navigation-link +- **Category:** theme +- **Supports:** typography (fontSize, lineHeight) +- **Attributes:** label, linkLabel, showTitle, textAlign, type + +## Post Template + +Contains the block elements used to render a post, like the title, date, featured image, content or excerpt, and more. + +- **Name:** core/post-template +- **Category:** design +- **Supports:** align +- **Attributes:** + +## Post Terms + +Post terms. + +- **Name:** core/post-terms +- **Category:** design +- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Attributes:** separator, term, textAlign + +## Post Title + +Displays the title of a post, page, or any other content-type. + +- **Name:** core/post-title +- **Category:** theme +- **Supports:** align (full, wide), color (gradients, link), spacing (margin), typography (fontSize, lineHeight) +- **Attributes:** isLink, level, linkTarget, rel, textAlign + +## Preformatted + +Add text that respects your spacing and tabs, and also allows styling. + +- **Name:** core/preformatted +- **Category:** text +- **Supports:** anchor, color (gradients), typography (fontSize, lineHeight) +- **Attributes:** content + +## Pullquote + +Give special visual emphasis to a quote from your text. + +- **Name:** core/pullquote +- **Category:** text +- **Supports:** align (full, left, right, wide), anchor, color (background, gradients, link), typography (fontSize, lineHeight) +- **Attributes:** citation, textAlign, value + +## Query Loop + +An advanced block that allows displaying post types based on different query parameters and visual configurations. + +- **Name:** core/query +- **Category:** theme +- **Supports:** align (full, wide), color (gradients, link) +- **Attributes:** displayLayout, query, queryId, tagName + +## Query Pagination + +Displays a paginated navigation to next/previous set of posts, when applicable. + +- **Name:** core/query-pagination +- **Category:** design +- **Supports:** align, color (gradients, link) +- **Attributes:** paginationArrow + +## Query Pagination Next + +Displays the next posts page link. + +- **Name:** core/query-pagination-next +- **Category:** design +- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Attributes:** label + +## Query Pagination Numbers + +Displays a list of page numbers for pagination + +- **Name:** core/query-pagination-numbers +- **Category:** design +- **Supports:** +- **Attributes:** + +## Query Pagination Previous + +Displays the previous posts page link. + +- **Name:** core/query-pagination-previous +- **Category:** design +- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Attributes:** label + +## Query Title + +Display the query title. + +- **Name:** core/query-title +- **Category:** design +- **Supports:** align (full, wide), color (gradients), spacing (margin), typography (fontSize, lineHeight) +- **Attributes:** level, textAlign, type + +## Quote + +Give quoted text visual emphasis. "In quoting others, we cite ourselves." — Julio Cortázar + +- **Name:** core/quote +- **Category:** text +- **Supports:** anchor, typography (fontSize, lineHeight) +- **Attributes:** align, citation, value + +## RSS + +Display entries from any RSS or Atom feed. + +- **Name:** core/rss +- **Category:** widgets +- **Supports:** align +- **Attributes:** blockLayout, columns, displayAuthor, displayDate, displayExcerpt, excerptLength, feedURL, itemsToShow + +## Search + +Help visitors find your content. + +- **Name:** core/search +- **Category:** widgets +- **Supports:** align (center, left, right), color (gradients) +- **Attributes:** buttonPosition, buttonText, buttonUseIcon, label, placeholder, showLabel, width, widthUnit + +## Separator + +Create a break between ideas or sections with a horizontal separator. + +- **Name:** core/separator +- **Category:** design +- **Supports:** align (center, full, wide), anchor +- **Attributes:** color, customColor + +## Shortcode + +Insert additional custom elements with a WordPress shortcode. + +- **Name:** core/shortcode +- **Category:** widgets +- **Supports:** +- **Attributes:** text + +## Site Logo + +Display a graphic to represent this site. Update the block, and the changes apply everywhere it’s used. This is different than the site icon, which is the smaller image visible in your dashboard, browser tabs, etc used to help others recognize this site. + +- **Name:** core/site-logo +- **Category:** layout +- **Supports:** align, color () +- **Attributes:** align, isLink, linkTarget, width + +## Site Tagline + +Describe in a few words what the site is about. The tagline can be used in search results or when sharing on social networks even if it's not displayed in the theme design. + +- **Name:** core/site-tagline +- **Category:** design +- **Supports:** align (full, wide), color (gradients), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** textAlign + +## Site Title + +Displays the name of this site. Update the block, and the changes apply everywhere it’s used. This will also appear in the browser title bar and in search results. + +- **Name:** core/site-title +- **Category:** design +- **Supports:** align (full, wide), color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight) +- **Attributes:** isLink, level, linkTarget, textAlign + +## Social Icon + +Display an icon linking to a social media profile or site. + +- **Name:** core/social-link +- **Category:** widgets +- **Supports:** +- **Attributes:** label, service, url + +## Social Icons + +Display icons linking to your social media profiles or sites. + +- **Name:** core/social-links +- **Category:** widgets +- **Supports:** align (center, left, right), anchor, spacing (blockGap, margin, units) +- **Attributes:** customIconBackgroundColor, customIconColor, iconBackgroundColor, iconBackgroundColorValue, iconColor, iconColorValue, openInNewTab, size + +## Spacer + +Add white space between blocks and customize its height. + +- **Name:** core/spacer +- **Category:** design +- **Supports:** anchor +- **Attributes:** height, width + +## Table + +Create structured content in rows and columns to display information. + +- **Name:** core/table +- **Category:** text +- **Supports:** align, anchor, color (gradients), typography (fontSize, lineHeight) +- **Attributes:** body, caption, foot, hasFixedLayout, head + +## Table of Contents + +Summarize your post with a list of headings. Add HTML anchors to Heading blocks to link them here. + +- **Name:** core/table-of-contents +- **Category:** layout +- **Supports:** +- **Attributes:** onlyIncludeCurrentPage + +## Tag Cloud + +A cloud of your most used tags. + +- **Name:** core/tag-cloud +- **Category:** widgets +- **Supports:** align +- **Attributes:** numberOfTags, showTagCounts, taxonomy + +## Template Part + +Edit the different global regions of your site, like the header, footer, sidebar, or create your own. + +- **Name:** core/template-part +- **Category:** theme +- **Supports:** align, color (gradients, link), spacing (padding) +- **Attributes:** area, slug, tagName, theme + +## Term Description + +Display the description of categories, tags and custom taxonomies when viewing an archive. + +- **Name:** core/term-description +- **Category:** theme +- **Supports:** align (full, wide), color (link), typography (fontSize, lineHeight) +- **Attributes:** textAlign + +## Text Columns (deprecated) + +This block is deprecated. Please use the Columns block instead. + +- **Name:** core/text-columns +- **Category:** design +- **Supports:** +- **Attributes:** columns, content, width + +## Verse + +Insert poetry. Use special spacing formats. Or quote song lyrics. + +- **Name:** core/verse +- **Category:** text +- **Supports:** anchor, color (gradients, link), spacing (padding), typography (fontSize, lineHeight) +- **Attributes:** content, textAlign + +## Video + +Embed a video from your media library or upload a new one. + +- **Name:** core/video +- **Category:** media +- **Supports:** align, anchor +- **Attributes:** autoplay, caption, controls, id, loop, muted, playsInline, poster, preload, src, tracks + + diff --git a/docs/toc.json b/docs/toc.json index ff630ba74f438..35186a8579a4c 100644 --- a/docs/toc.json +++ b/docs/toc.json @@ -194,6 +194,7 @@ } ] }, + { "docs/reference-guides/core-blocks.md": [] }, { "docs/reference-guides/filters/README.md": [ { "docs/reference-guides/filters/block-filters.md": [] }, diff --git a/package.json b/package.json index b93e9230ca28b..2078ef5998a24 100644 --- a/package.json +++ b/package.json @@ -237,7 +237,7 @@ "dev": "npm run build:packages && concurrently \"wp-scripts start\" \"npm run dev:packages\"", "dev:packages": "node ./bin/packages/watch.js", "distclean": "rimraf node_modules packages/*/node_modules", - "docs:build": "node ./docs/tool/index.js && node ./bin/api-docs/update-api-docs.js", + "docs:build": "node ./docs/tool/index.js && node ./bin/api-docs/update-api-docs.js && node ./bin/api-docs/gen-block-lib-list.js", "fixtures:clean": "rimraf \"test/integration/fixtures/blocks/*.+(json|serialized.html)\"", "fixtures:generate": "cross-env GENERATE_MISSING_FIXTURES=y npm run test-unit test/integration/full-content/ && npm run format test/integration/fixtures/blocks/*.json", "fixtures:regenerate": "npm run fixtures:clean && npm run fixtures:generate", From e30b7230d1e5df65000a88d7b6d3c096f0661b45 Mon Sep 17 00:00:00 2001 From: Marcus Kazmierczak Date: Sat, 18 Dec 2021 07:51:41 -0800 Subject: [PATCH 2/7] Add strikeout to false values in supports --- bin/api-docs/gen-block-lib-list.js | 18 ++- docs/reference-guides/core-blocks.md | 182 +++++++++++++++------------ 2 files changed, 112 insertions(+), 88 deletions(-) diff --git a/bin/api-docs/gen-block-lib-list.js b/bin/api-docs/gen-block-lib-list.js index 8426be278070c..0f3d2451c40dc 100644 --- a/bin/api-docs/gen-block-lib-list.js +++ b/bin/api-docs/gen-block-lib-list.js @@ -1,10 +1,16 @@ +/** + * Generates core block documentation using block.json files. + * Reads from : packages/block-library/src + * Publishes to: docs/reference-guides/core-blocks.ms + */ + /** * External dependencies */ const { resolve } = require( 'path' ); const glob = require( 'fast-glob' ); const fs = require( 'fs' ); -const { keys, pickBy } = require( 'lodash' ); +const { keys } = require( 'lodash' ); /** * Path to root project directory. * @@ -52,16 +58,16 @@ const END_TOKEN = ''; const TOKEN_PATTERN = new RegExp( START_TOKEN + '[^]*' + END_TOKEN ); /** - * Uses lodash keys and pickby to get keys with truthy values, - * filtering out any experimental keys. + * Returns list of keys, filtering out any experimental + * and wrapping keys with ~~ to strikeout false values. * * @type {Object} obj * @return {string[]} Array of truthy keys */ function getTruthyKeys( obj ) { - return keys( pickBy( obj ) ).filter( - ( key ) => ! key.startsWith( '__exp' ) - ); + return keys( obj ) + .filter( ( key ) => ! key.startsWith( '__exp' ) ) + .map( ( key ) => ( obj[ key ] ? key : `~~${ key }~~` ) ); } /** diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index dd8f09ab3dc69..355b0d067c120 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -10,7 +10,7 @@ Display a monthly archive of your posts. - **Name:** core/archives - **Category:** widgets -- **Supports:** align +- **Supports:** align, ~~html~~ - **Attributes:** displayAsDropdown, showPostCounts ## Audio @@ -28,7 +28,7 @@ Create and save content to reuse across your site. Update the block, and the cha - **Name:** core/block - **Category:** reusable -- **Supports:** +- **Supports:** ~~customClassName~~, ~~html~~, ~~inserter~~ - **Attributes:** ref ## Button @@ -37,7 +37,7 @@ Prompt visitors to take action with a button-style link. - **Name:** core/button - **Category:** design -- **Supports:** align, anchor, color (gradients), spacing (padding), typography (fontSize) +- **Supports:** align, anchor, color (gradients), spacing (padding), typography (fontSize), ~~alignWide~~, ~~reusable~~ - **Attributes:** backgroundColor, gradient, linkTarget, placeholder, rel, text, textColor, title, url, width ## Buttons @@ -64,7 +64,7 @@ Display a list of all categories. - **Name:** core/categories - **Category:** widgets -- **Supports:** align +- **Supports:** align, ~~html~~ - **Attributes:** displayAsDropdown, showHierarchy, showOnlyTopLevel, showPostCounts ## Code @@ -82,7 +82,7 @@ A single column within a columns block. - **Name:** core/column - **Category:** text -- **Supports:** anchor, color (gradients, link), spacing (padding) +- **Supports:** anchor, color (gradients, link), spacing (padding), ~~html~~, ~~reusable~~ - **Attributes:** allowedBlocks, templateLock, verticalAlignment, width ## Columns @@ -91,7 +91,7 @@ Display content in multiple columns, with blocks added to each column. - **Name:** core/columns - **Category:** design -- **Supports:** align (full, wide), anchor, color (gradients, link), spacing (blockGap, margin, padding) +- **Supports:** align (full, wide), anchor, color (gradients, link), spacing (blockGap, margin, padding), ~~html~~ - **Attributes:** isStackedOnMobile, verticalAlignment ## Comment Author Avatar @@ -100,7 +100,7 @@ Add the avatar of this comment's author. - **Name:** core/comment-author-avatar - **Category:** theme -- **Supports:** color (background) +- **Supports:** color (background, ~~text~~), spacing (margin, padding), ~~html~~ - **Attributes:** height, width ## Comment Author Name @@ -109,7 +109,7 @@ Add the author name of this comment. - **Name:** core/comment-author-name - **Category:** theme -- **Supports:** color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight) +- **Supports:** color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** isLink, linkTarget, textAlign ## Comment Content @@ -118,7 +118,7 @@ Displays the contents of a comment. - **Name:** core/comment-content - **Category:** theme -- **Supports:** color (gradients, link), spacing (padding), typography (fontSize, lineHeight) +- **Supports:** color (gradients, link), spacing (padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Comment Date @@ -127,7 +127,7 @@ Add the date of this comment. - **Name:** core/comment-date - **Category:** theme -- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Supports:** color (gradients, link), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** format, isLink ## Comment Edit Link @@ -136,7 +136,7 @@ Displays a link to edit the comment in the WordPress Dashboard. This link is onl - **Name:** core/comment-edit-link - **Category:** theme -- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Supports:** color (gradients, link, ~~text~~), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** linkTarget, textAlign ## Comment Reply Link @@ -145,7 +145,7 @@ Displays a link to reply to a comment. - **Name:** core/comment-reply-link - **Category:** theme -- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Supports:** color (gradients, link, ~~text~~), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Comment Template @@ -154,7 +154,25 @@ Contains the block elements used to render a comment, like the title, date, auth - **Name:** core/comment-template - **Category:** design -- **Supports:** align +- **Supports:** align, ~~html~~, ~~reusable~~ +- **Attributes:** + +## Comments Pagination + +Displays a paginated navigation to next/previous set of comments, when applicable. + +- **Name:** core/comments-pagination +- **Category:** design +- **Supports:** align, color (gradients, link), ~~html~~, ~~reusable~~ +- **Attributes:** paginationArrow + +## Comments Pagination Numbers + +Displays a list of page numbers for comments pagination. + +- **Name:** core/comments-pagination-numbers +- **Category:** theme +- **Supports:** ~~html~~, ~~reusable~~ - **Attributes:** ## Comments Query Loop @@ -163,8 +181,8 @@ An advanced block that allows displaying post comments based on different query - **Name:** core/comments-query-loop - **Category:** theme -- **Supports:** align (full, wide), color (gradients, link) -- **Attributes:** queryId, queryPerPage, tagName +- **Supports:** align (full, wide), color (gradients, link), ~~html~~ +- **Attributes:** perPage, tagName ## Cover @@ -172,7 +190,7 @@ Add an image or video with a text overlay — great for headers. - **Name:** core/cover - **Category:** media -- **Supports:** align, anchor, color (), spacing (padding) +- **Supports:** align, anchor, color (~~background~~, ~~text~~), spacing (padding), ~~html~~ - **Attributes:** allowedBlocks, alt, backgroundType, contentPosition, customGradient, customOverlayColor, dimRatio, focalPoint, gradient, hasParallax, id, isDark, isRepeated, minHeight, minHeightUnit, overlayColor, templateLock, url ## Embed @@ -199,7 +217,7 @@ Use the classic WordPress editor. - **Name:** core/freeform - **Category:** text -- **Supports:** +- **Supports:** ~~className~~, ~~customClassName~~, ~~reusable~~ - **Attributes:** content ## Gallery @@ -217,7 +235,7 @@ Combine blocks into a group. - **Name:** core/group - **Category:** design -- **Supports:** align (full, wide), anchor, color (gradients, link), spacing (padding) +- **Supports:** align (full, wide), anchor, color (gradients, link), spacing (padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** tagName, templateLock ## Heading @@ -226,7 +244,7 @@ Introduce new sections and organize content to help visitors (and search engines - **Name:** core/heading - **Category:** text -- **Supports:** __unstablePasteTextInline, align (full, wide), anchor, color (link), spacing (margin), typography (fontSize, lineHeight) +- **Supports:** __unstablePasteTextInline, align (full, wide), anchor, color (link), spacing (margin), typography (fontSize, lineHeight), ~~className~~ - **Attributes:** content, level, placeholder, textAlign ## Home Link @@ -235,7 +253,7 @@ Create a link that always points to the homepage of the site. Usually not necess - **Name:** core/home-link - **Category:** design -- **Supports:** +- **Supports:** ~~html~~, ~~reusable~~ - **Attributes:** label ## Custom HTML @@ -244,7 +262,7 @@ Add custom HTML code and preview it as you edit. - **Name:** core/html - **Category:** widgets -- **Supports:** +- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~ - **Attributes:** content ## Image @@ -253,7 +271,7 @@ Insert an image to make a visual statement. - **Name:** core/image - **Category:** media -- **Supports:** anchor, color () +- **Supports:** anchor, color (~~background~~, ~~text~~) - **Attributes:** align, alt, caption, height, href, id, linkClass, linkDestination, linkTarget, rel, sizeSlug, title, url, width ## Latest Comments @@ -262,7 +280,7 @@ Display a list of your most recent comments. - **Name:** core/latest-comments - **Category:** widgets -- **Supports:** align +- **Supports:** align, ~~html~~ - **Attributes:** commentsToShow, displayAvatar, displayDate, displayExcerpt ## Latest Posts @@ -271,7 +289,7 @@ Display a list of your most recent posts. - **Name:** core/latest-posts - **Category:** widgets -- **Supports:** align +- **Supports:** align, ~~html~~ - **Attributes:** addLinkToFeaturedImage, categories, columns, displayAuthor, displayFeaturedImage, displayPostContent, displayPostContentRadio, displayPostDate, excerptLength, featuredImageAlign, featuredImageSizeHeight, featuredImageSizeSlug, featuredImageSizeWidth, order, orderBy, postLayout, postsToShow, selectedAuthor ## List @@ -280,7 +298,7 @@ Create a bulleted or numbered list. - **Name:** core/list - **Category:** text -- **Supports:** __unstablePasteTextInline, anchor, color (gradients, link), typography (fontSize, lineHeight) +- **Supports:** __unstablePasteTextInline, anchor, color (gradients, link), typography (fontSize, lineHeight), ~~className~~ - **Attributes:** ordered, placeholder, reversed, start, type, values ## Login/out @@ -289,7 +307,7 @@ Show login & logout links. - **Name:** core/loginout - **Category:** theme -- **Supports:** className, typography () +- **Supports:** className, typography (~~fontSize~~) - **Attributes:** displayLoginAsForm, redirectToCurrent ## Media & Text @@ -298,7 +316,7 @@ Set media and words side-by-side for a richer layout. - **Name:** core/media-text - **Category:** media -- **Supports:** align (full, wide), anchor, color (gradients, link) +- **Supports:** align (full, wide), anchor, color (gradients, link), ~~html~~ - **Attributes:** align, focalPoint, href, imageFill, isStackedOnMobile, linkClass, linkDestination, linkTarget, mediaAlt, mediaId, mediaLink, mediaPosition, mediaSizeSlug, mediaType, mediaUrl, mediaWidth, rel, verticalAlignment ## Unsupported @@ -307,7 +325,7 @@ Your site doesn’t include support for this block. - **Name:** core/missing - **Category:** text -- **Supports:** +- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~, ~~inserter~~, ~~reusable~~ - **Attributes:** originalContent, originalName, originalUndelimitedContent ## More @@ -316,7 +334,7 @@ Content before this block will be shown in the excerpt on your archives page. - **Name:** core/more - **Category:** design -- **Supports:** +- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~, ~~multiple~~ - **Attributes:** customText, noTeaser ## Navigation @@ -325,8 +343,8 @@ A collection of blocks that allow visitors to get around your site. - **Name:** core/navigation - **Category:** theme -- **Supports:** align (full, wide), anchor, inserter, spacing (blockGap, units), typography (fontSize, lineHeight) -- **Attributes:** __unstableLocation, backgroundColor, customBackgroundColor, customOverlayBackgroundColor, customOverlayTextColor, customTextColor, navigationMenuId, openSubmenusOnClick, overlayBackgroundColor, overlayMenu, overlayTextColor, rgbBackgroundColor, rgbTextColor, showSubmenuIcon, textColor +- **Supports:** align (full, wide), anchor, inserter, spacing (blockGap, units), typography (fontSize, lineHeight), ~~html~~ +- **Attributes:** __unstableLocation, backgroundColor, customBackgroundColor, customOverlayBackgroundColor, customOverlayTextColor, customTextColor, openSubmenusOnClick, overlayBackgroundColor, overlayMenu, overlayTextColor, ref, rgbBackgroundColor, rgbTextColor, showSubmenuIcon, textColor ## Navigation Area @@ -334,7 +352,7 @@ Define a navigation area for your theme. The navigation block associated with th - **Name:** core/navigation-area - **Category:** theme -- **Supports:** inserter +- **Supports:** ~~html~~, ~~inserter~~ - **Attributes:** area ## Custom Link @@ -343,7 +361,7 @@ Add a page, link, or another item to your navigation. - **Name:** core/navigation-link - **Category:** design -- **Supports:** +- **Supports:** ~~html~~, ~~reusable~~ - **Attributes:** description, id, isTopLevelLink, kind, label, opensInNewTab, rel, title, type, url ## Submenu @@ -352,7 +370,7 @@ Add a submenu to your navigation. - **Name:** core/navigation-submenu - **Category:** design -- **Supports:** +- **Supports:** ~~html~~, ~~reusable~~ - **Attributes:** description, id, isTopLevelItem, kind, label, opensInNewTab, rel, title, type, url ## Page Break @@ -361,7 +379,7 @@ Separate your content into a multi-page experience. - **Name:** core/nextpage - **Category:** design -- **Supports:** +- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~ - **Attributes:** ## Page List @@ -370,8 +388,8 @@ Display a list of all pages. - **Name:** core/page-list - **Category:** widgets -- **Supports:** -- **Attributes:** +- **Supports:** ~~html~~, ~~reusable~~ +- **Attributes:** __unstableMaxPages ## Paragraph @@ -379,7 +397,7 @@ Start with the building block of all narrative. - **Name:** core/paragraph - **Category:** text -- **Supports:** __unstablePasteTextInline, anchor, color (link), typography (fontSize, lineHeight) +- **Supports:** __unstablePasteTextInline, anchor, color (link), typography (fontSize, lineHeight), ~~className~~ - **Attributes:** align, content, direction, dropCap, placeholder ## Pattern @@ -387,8 +405,8 @@ Start with the building block of all narrative. Show a block pattern. - **Name:** core/pattern -- **Category:** design -- **Supports:** +- **Category:** theme +- **Supports:** ~~html~~, ~~inserter~~ - **Attributes:** slug ## Post Author @@ -397,7 +415,7 @@ Add the author of this post. - **Name:** core/post-author - **Category:** theme -- **Supports:** color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight) +- **Supports:** color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** avatarSize, byline, showAvatar, showBio, textAlign ## Post Comment (deprecated) @@ -406,7 +424,7 @@ This block is deprecated. Please use the Comments Query Loop block instead. - **Name:** core/post-comment - **Category:** theme -- **Supports:** +- **Supports:** ~~html~~, ~~inserter~~ - **Attributes:** commentId ## Post Comments @@ -415,7 +433,7 @@ Display a post's comments. - **Name:** core/post-comments - **Category:** theme -- **Supports:** align (full, wide), color (gradients, link), typography (fontSize, lineHeight) +- **Supports:** align (full, wide), color (gradients, link), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Post Comments Count @@ -424,7 +442,7 @@ Display a post's comments count. - **Name:** core/post-comments-count - **Category:** theme -- **Supports:** color (gradients), typography (fontSize, lineHeight) +- **Supports:** color (gradients), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Post Comments Form @@ -433,7 +451,7 @@ Display a post's comments form. - **Name:** core/post-comments-form - **Category:** theme -- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Supports:** color (gradients, link), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Post Comments Link @@ -442,7 +460,7 @@ Displays the link to the current post comments. - **Name:** core/post-comments-link - **Category:** theme -- **Supports:** color (link), typography (fontSize, lineHeight) +- **Supports:** color (link, ~~text~~), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Post Content @@ -451,7 +469,7 @@ Displays the contents of a post or page. - **Name:** core/post-content - **Category:** theme -- **Supports:** align (full, wide) +- **Supports:** align (full, wide), ~~html~~ - **Attributes:** ## Post Date @@ -460,7 +478,7 @@ Add the date of this post. - **Name:** core/post-date - **Category:** theme -- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Supports:** color (gradients, link), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** format, isLink, textAlign ## Post Excerpt @@ -469,7 +487,7 @@ Display a post's excerpt. - **Name:** core/post-excerpt - **Category:** theme -- **Supports:** color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight) +- **Supports:** color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** moreText, showMoreOnNewLine, textAlign ## Post Featured Image @@ -478,7 +496,7 @@ Display a post's featured image. - **Name:** core/post-featured-image - **Category:** theme -- **Supports:** align (center, full, left, right, wide), color (), spacing (margin, padding) +- **Supports:** align (center, full, left, right, wide), color (~~background~~, ~~text~~), spacing (margin, padding), ~~html~~ - **Attributes:** height, isLink, scale, width ## Post Navigation Link @@ -487,7 +505,7 @@ Displays the next or previous post link that is adjacent to the current post. - **Name:** core/post-navigation-link - **Category:** theme -- **Supports:** typography (fontSize, lineHeight) +- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label, linkLabel, showTitle, textAlign, type ## Post Template @@ -496,7 +514,7 @@ Contains the block elements used to render a post, like the title, date, feature - **Name:** core/post-template - **Category:** design -- **Supports:** align +- **Supports:** align, ~~html~~, ~~reusable~~ - **Attributes:** ## Post Terms @@ -504,8 +522,8 @@ Contains the block elements used to render a post, like the title, date, feature Post terms. - **Name:** core/post-terms -- **Category:** design -- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Category:** theme +- **Supports:** color (gradients, link), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** separator, term, textAlign ## Post Title @@ -514,7 +532,7 @@ Displays the title of a post, page, or any other content-type. - **Name:** core/post-title - **Category:** theme -- **Supports:** align (full, wide), color (gradients, link), spacing (margin), typography (fontSize, lineHeight) +- **Supports:** align (full, wide), color (gradients, link), spacing (margin), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** isLink, level, linkTarget, rel, textAlign ## Preformatted @@ -541,43 +559,43 @@ An advanced block that allows displaying post types based on different query par - **Name:** core/query - **Category:** theme -- **Supports:** align (full, wide), color (gradients, link) +- **Supports:** align (full, wide), color (gradients, link), ~~html~~ - **Attributes:** displayLayout, query, queryId, tagName -## Query Pagination +## Pagination Displays a paginated navigation to next/previous set of posts, when applicable. - **Name:** core/query-pagination - **Category:** design -- **Supports:** align, color (gradients, link) +- **Supports:** align, color (gradients, link), ~~html~~, ~~reusable~~ - **Attributes:** paginationArrow -## Query Pagination Next +## Next Page Displays the next posts page link. - **Name:** core/query-pagination-next - **Category:** design -- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Supports:** color (gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label -## Query Pagination Numbers +## Page Numbers Displays a list of page numbers for pagination - **Name:** core/query-pagination-numbers - **Category:** design -- **Supports:** +- **Supports:** ~~html~~, ~~reusable~~ - **Attributes:** -## Query Pagination Previous +## Previous Page Displays the previous posts page link. - **Name:** core/query-pagination-previous - **Category:** design -- **Supports:** color (gradients, link), typography (fontSize, lineHeight) +- **Supports:** color (gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label ## Query Title @@ -585,8 +603,8 @@ Displays the previous posts page link. Display the query title. - **Name:** core/query-title -- **Category:** design -- **Supports:** align (full, wide), color (gradients), spacing (margin), typography (fontSize, lineHeight) +- **Category:** theme +- **Supports:** align (full, wide), color (gradients), spacing (margin), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** level, textAlign, type ## Quote @@ -604,7 +622,7 @@ Display entries from any RSS or Atom feed. - **Name:** core/rss - **Category:** widgets -- **Supports:** align +- **Supports:** align, ~~html~~ - **Attributes:** blockLayout, columns, displayAuthor, displayDate, displayExcerpt, excerptLength, feedURL, itemsToShow ## Search @@ -613,7 +631,7 @@ Help visitors find your content. - **Name:** core/search - **Category:** widgets -- **Supports:** align (center, left, right), color (gradients) +- **Supports:** align (center, left, right), color (gradients), ~~html~~ - **Attributes:** buttonPosition, buttonText, buttonUseIcon, label, placeholder, showLabel, width, widthUnit ## Separator @@ -631,7 +649,7 @@ Insert additional custom elements with a WordPress shortcode. - **Name:** core/shortcode - **Category:** widgets -- **Supports:** +- **Supports:** ~~className~~, ~~customClassName~~, ~~html~~ - **Attributes:** text ## Site Logo @@ -639,17 +657,17 @@ Insert additional custom elements with a WordPress shortcode. Display a graphic to represent this site. Update the block, and the changes apply everywhere it’s used. This is different than the site icon, which is the smaller image visible in your dashboard, browser tabs, etc used to help others recognize this site. - **Name:** core/site-logo -- **Category:** layout -- **Supports:** align, color () -- **Attributes:** align, isLink, linkTarget, width +- **Category:** theme +- **Supports:** align, color (~~background~~, ~~text~~), ~~alignWide~~, ~~html~~ +- **Attributes:** isLink, linkTarget, width ## Site Tagline Describe in a few words what the site is about. The tagline can be used in search results or when sharing on social networks even if it's not displayed in the theme design. - **Name:** core/site-tagline -- **Category:** design -- **Supports:** align (full, wide), color (gradients), spacing (margin, padding), typography (fontSize, lineHeight) +- **Category:** theme +- **Supports:** align (full, wide), color (gradients), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Site Title @@ -657,8 +675,8 @@ Describe in a few words what the site is about. The tagline can be used in searc Displays the name of this site. Update the block, and the changes apply everywhere it’s used. This will also appear in the browser title bar and in search results. - **Name:** core/site-title -- **Category:** design -- **Supports:** align (full, wide), color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight) +- **Category:** theme +- **Supports:** align (full, wide), color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** isLink, level, linkTarget, textAlign ## Social Icon @@ -667,7 +685,7 @@ Display an icon linking to a social media profile or site. - **Name:** core/social-link - **Category:** widgets -- **Supports:** +- **Supports:** ~~html~~, ~~reusable~~ - **Attributes:** label, service, url ## Social Icons @@ -703,7 +721,7 @@ Summarize your post with a list of headings. Add HTML anchors to Heading blocks - **Name:** core/table-of-contents - **Category:** layout -- **Supports:** +- **Supports:** ~~html~~ - **Attributes:** onlyIncludeCurrentPage ## Tag Cloud @@ -712,7 +730,7 @@ A cloud of your most used tags. - **Name:** core/tag-cloud - **Category:** widgets -- **Supports:** align +- **Supports:** align, ~~html~~ - **Attributes:** numberOfTags, showTagCounts, taxonomy ## Template Part @@ -721,7 +739,7 @@ Edit the different global regions of your site, like the header, footer, sidebar - **Name:** core/template-part - **Category:** theme -- **Supports:** align, color (gradients, link), spacing (padding) +- **Supports:** align, ~~html~~, ~~reusable~~ - **Attributes:** area, slug, tagName, theme ## Term Description @@ -730,7 +748,7 @@ Display the description of categories, tags and custom taxonomies when viewing a - **Name:** core/term-description - **Category:** theme -- **Supports:** align (full, wide), color (link), typography (fontSize, lineHeight) +- **Supports:** align (full, wide), color (link), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Text Columns (deprecated) @@ -739,7 +757,7 @@ This block is deprecated. Please use the Columns block instead. - **Name:** core/text-columns - **Category:** design -- **Supports:** +- **Supports:** ~~inserter~~ - **Attributes:** columns, content, width ## Verse From 9ea19c84e1f1fb3d3f9b64518047e7d879f94458 Mon Sep 17 00:00:00 2001 From: Marcus Kazmierczak Date: Mon, 20 Dec 2021 08:31:21 -0800 Subject: [PATCH 3/7] Update color supports with default background/text Adds a function to augment the color supports if specified to include background and text, if not disabled. Plus a few minor fixes to support Windows. --- bin/api-docs/gen-block-lib-list.js | 48 +++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/bin/api-docs/gen-block-lib-list.js b/bin/api-docs/gen-block-lib-list.js index 0f3d2451c40dc..7ae5b99e753da 100644 --- a/bin/api-docs/gen-block-lib-list.js +++ b/bin/api-docs/gen-block-lib-list.js @@ -7,7 +7,7 @@ /** * External dependencies */ -const { resolve } = require( 'path' ); +const path = require( 'path' ); const glob = require( 'fast-glob' ); const fs = require( 'fs' ); const { keys } = require( 'lodash' ); @@ -16,21 +16,24 @@ const { keys } = require( 'lodash' ); * * @type {string} */ -const ROOT_DIR = resolve( __dirname, '../..' ); +const ROOT_DIR = path.resolve( __dirname, '../..' ); /** * Path to packages directory. * * @type {string} */ -const BLOCK_LIBRARY_DIR = resolve( ROOT_DIR, 'packages/block-library/src' ); +const BLOCK_LIBRARY_DIR = path.resolve( + ROOT_DIR, + 'packages/block-library/src' +); /** * Path to docs file. * * @type {string} */ -const BLOCK_LIBRARY_DOCS_FILE = resolve( +const BLOCK_LIBRARY_DOCS_FILE = path.resolve( ROOT_DIR, 'docs/reference-guides/core-blocks.md' ); @@ -95,6 +98,30 @@ function processObjWithInnerKeys( obj ) { return rtn; } +/** + * Augment supports with additional default props. + * + * The color support if specified defaults background and text, if + * not disabled. So adding { color: 'link' } support also brings along + * background and text. + * + * @param {Object} supports - keys supported by blokc + * @return {Object} supports augmented with defaults + */ +function augmentSupports( supports ) { + if ( 'color' in supports ) { + // If backgroud or text is not specified (true or false) + // then add it as true.a + if ( ! ( 'background' in supports.color ) ) { + supports.color.background = true; + } + if ( ! ( 'text' in supports.color ) ) { + supports.color.text = true; + } + } + return supports; +} + /** * Reads block.json file and returns markdown formatted entry. * @@ -106,7 +133,8 @@ function readBlockJSON( filename ) { const data = fs.readFileSync( filename, 'utf8' ); const blockjson = JSON.parse( data ); - const supports = processObjWithInnerKeys( blockjson.supports ); + const supportsAugmented = augmentSupports( blockjson.supports ); + const supportsList = processObjWithInnerKeys( supportsAugmented ); const attributes = getTruthyKeys( blockjson.attributes ); return ` @@ -116,13 +144,17 @@ ${ blockjson.description } - **Name:** ${ blockjson.name } - **Category:** ${ blockjson.category } -- **Supports:** ${ supports.sort().join( ', ' ) } +- **Supports:** ${ supportsList.sort().join( ', ' ) } - **Attributes:** ${ attributes.sort().join( ', ' ) } `; } -// Generate block docs -const files = glob.sync( `${ BLOCK_LIBRARY_DIR }/*/block.json` ); +// Generate block docs. +// Note: The replace() is to translate Windows back to Unix for fast-glob. +const files = glob.sync( + path.join( BLOCK_LIBRARY_DIR, '*', 'block.json' ).replace( /\\/g, '/' ) +); + let autogen = ''; files.forEach( ( file ) => { From f02d5682b4cb25154aa5c3e845b20cb085d6b05f Mon Sep 17 00:00:00 2001 From: Marcus Kazmierczak Date: Mon, 20 Dec 2021 08:32:23 -0800 Subject: [PATCH 4/7] Update documentation with new script --- docs/reference-guides/core-blocks.md | 74 ++++++++++++++-------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 355b0d067c120..ab6dec3728050 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -37,7 +37,7 @@ Prompt visitors to take action with a button-style link. - **Name:** core/button - **Category:** design -- **Supports:** align, anchor, color (gradients), spacing (padding), typography (fontSize), ~~alignWide~~, ~~reusable~~ +- **Supports:** align, anchor, color (background, gradients, text), spacing (padding), typography (fontSize), ~~alignWide~~, ~~reusable~~ - **Attributes:** backgroundColor, gradient, linkTarget, placeholder, rel, text, textColor, title, url, width ## Buttons @@ -82,7 +82,7 @@ A single column within a columns block. - **Name:** core/column - **Category:** text -- **Supports:** anchor, color (gradients, link), spacing (padding), ~~html~~, ~~reusable~~ +- **Supports:** anchor, color (background, gradients, link, text), spacing (padding), ~~html~~, ~~reusable~~ - **Attributes:** allowedBlocks, templateLock, verticalAlignment, width ## Columns @@ -91,7 +91,7 @@ Display content in multiple columns, with blocks added to each column. - **Name:** core/columns - **Category:** design -- **Supports:** align (full, wide), anchor, color (gradients, link), spacing (blockGap, margin, padding), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), spacing (blockGap, margin, padding), ~~html~~ - **Attributes:** isStackedOnMobile, verticalAlignment ## Comment Author Avatar @@ -109,7 +109,7 @@ Add the author name of this comment. - **Name:** core/comment-author-name - **Category:** theme -- **Supports:** color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** isLink, linkTarget, textAlign ## Comment Content @@ -118,7 +118,7 @@ Displays the contents of a comment. - **Name:** core/comment-content - **Category:** theme -- **Supports:** color (gradients, link), spacing (padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** color (background, gradients, link, text), spacing (padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Comment Date @@ -127,7 +127,7 @@ Add the date of this comment. - **Name:** core/comment-date - **Category:** theme -- **Supports:** color (gradients, link), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** format, isLink ## Comment Edit Link @@ -136,7 +136,7 @@ Displays a link to edit the comment in the WordPress Dashboard. This link is onl - **Name:** core/comment-edit-link - **Category:** theme -- **Supports:** color (gradients, link, ~~text~~), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** color (background, gradients, link, ~~text~~), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** linkTarget, textAlign ## Comment Reply Link @@ -145,7 +145,7 @@ Displays a link to reply to a comment. - **Name:** core/comment-reply-link - **Category:** theme -- **Supports:** color (gradients, link, ~~text~~), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** color (background, gradients, link, ~~text~~), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Comment Template @@ -163,7 +163,7 @@ Displays a paginated navigation to next/previous set of comments, when applicabl - **Name:** core/comments-pagination - **Category:** design -- **Supports:** align, color (gradients, link), ~~html~~, ~~reusable~~ +- **Supports:** align, color (background, gradients, link, text), ~~html~~, ~~reusable~~ - **Attributes:** paginationArrow ## Comments Pagination Numbers @@ -181,7 +181,7 @@ An advanced block that allows displaying post comments based on different query - **Name:** core/comments-query-loop - **Category:** theme -- **Supports:** align (full, wide), color (gradients, link), ~~html~~ +- **Supports:** align (full, wide), color (background, gradients, link, text), ~~html~~ - **Attributes:** perPage, tagName ## Cover @@ -235,7 +235,7 @@ Combine blocks into a group. - **Name:** core/group - **Category:** design -- **Supports:** align (full, wide), anchor, color (gradients, link), spacing (padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), spacing (padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** tagName, templateLock ## Heading @@ -244,7 +244,7 @@ Introduce new sections and organize content to help visitors (and search engines - **Name:** core/heading - **Category:** text -- **Supports:** __unstablePasteTextInline, align (full, wide), anchor, color (link), spacing (margin), typography (fontSize, lineHeight), ~~className~~ +- **Supports:** __unstablePasteTextInline, align (full, wide), anchor, color (background, link, text), spacing (margin), typography (fontSize, lineHeight), ~~className~~ - **Attributes:** content, level, placeholder, textAlign ## Home Link @@ -298,7 +298,7 @@ Create a bulleted or numbered list. - **Name:** core/list - **Category:** text -- **Supports:** __unstablePasteTextInline, anchor, color (gradients, link), typography (fontSize, lineHeight), ~~className~~ +- **Supports:** __unstablePasteTextInline, anchor, color (background, gradients, link, text), typography (fontSize, lineHeight), ~~className~~ - **Attributes:** ordered, placeholder, reversed, start, type, values ## Login/out @@ -316,7 +316,7 @@ Set media and words side-by-side for a richer layout. - **Name:** core/media-text - **Category:** media -- **Supports:** align (full, wide), anchor, color (gradients, link), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), ~~html~~ - **Attributes:** align, focalPoint, href, imageFill, isStackedOnMobile, linkClass, linkDestination, linkTarget, mediaAlt, mediaId, mediaLink, mediaPosition, mediaSizeSlug, mediaType, mediaUrl, mediaWidth, rel, verticalAlignment ## Unsupported @@ -397,7 +397,7 @@ Start with the building block of all narrative. - **Name:** core/paragraph - **Category:** text -- **Supports:** __unstablePasteTextInline, anchor, color (link), typography (fontSize, lineHeight), ~~className~~ +- **Supports:** __unstablePasteTextInline, anchor, color (background, link, text), typography (fontSize, lineHeight), ~~className~~ - **Attributes:** align, content, direction, dropCap, placeholder ## Pattern @@ -415,7 +415,7 @@ Add the author of this post. - **Name:** core/post-author - **Category:** theme -- **Supports:** color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** avatarSize, byline, showAvatar, showBio, textAlign ## Post Comment (deprecated) @@ -433,7 +433,7 @@ Display a post's comments. - **Name:** core/post-comments - **Category:** theme -- **Supports:** align (full, wide), color (gradients, link), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Post Comments Count @@ -442,7 +442,7 @@ Display a post's comments count. - **Name:** core/post-comments-count - **Category:** theme -- **Supports:** color (gradients), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** color (background, gradients, text), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Post Comments Form @@ -451,7 +451,7 @@ Display a post's comments form. - **Name:** core/post-comments-form - **Category:** theme -- **Supports:** color (gradients, link), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Post Comments Link @@ -460,7 +460,7 @@ Displays the link to the current post comments. - **Name:** core/post-comments-link - **Category:** theme -- **Supports:** color (link, ~~text~~), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** color (background, link, ~~text~~), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Post Content @@ -478,7 +478,7 @@ Add the date of this post. - **Name:** core/post-date - **Category:** theme -- **Supports:** color (gradients, link), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** format, isLink, textAlign ## Post Excerpt @@ -487,7 +487,7 @@ Display a post's excerpt. - **Name:** core/post-excerpt - **Category:** theme -- **Supports:** color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** moreText, showMoreOnNewLine, textAlign ## Post Featured Image @@ -523,7 +523,7 @@ Post terms. - **Name:** core/post-terms - **Category:** theme -- **Supports:** color (gradients, link), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** color (background, gradients, link, text), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** separator, term, textAlign ## Post Title @@ -532,7 +532,7 @@ Displays the title of a post, page, or any other content-type. - **Name:** core/post-title - **Category:** theme -- **Supports:** align (full, wide), color (gradients, link), spacing (margin), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** isLink, level, linkTarget, rel, textAlign ## Preformatted @@ -541,7 +541,7 @@ Add text that respects your spacing and tabs, and also allows styling. - **Name:** core/preformatted - **Category:** text -- **Supports:** anchor, color (gradients), typography (fontSize, lineHeight) +- **Supports:** anchor, color (background, gradients, text), typography (fontSize, lineHeight) - **Attributes:** content ## Pullquote @@ -550,7 +550,7 @@ Give special visual emphasis to a quote from your text. - **Name:** core/pullquote - **Category:** text -- **Supports:** align (full, left, right, wide), anchor, color (background, gradients, link), typography (fontSize, lineHeight) +- **Supports:** align (full, left, right, wide), anchor, color (background, gradients, link, text), typography (fontSize, lineHeight) - **Attributes:** citation, textAlign, value ## Query Loop @@ -559,7 +559,7 @@ An advanced block that allows displaying post types based on different query par - **Name:** core/query - **Category:** theme -- **Supports:** align (full, wide), color (gradients, link), ~~html~~ +- **Supports:** align (full, wide), color (background, gradients, link, text), ~~html~~ - **Attributes:** displayLayout, query, queryId, tagName ## Pagination @@ -568,7 +568,7 @@ Displays a paginated navigation to next/previous set of posts, when applicable. - **Name:** core/query-pagination - **Category:** design -- **Supports:** align, color (gradients, link), ~~html~~, ~~reusable~~ +- **Supports:** align, color (background, gradients, link, text), ~~html~~, ~~reusable~~ - **Attributes:** paginationArrow ## Next Page @@ -577,7 +577,7 @@ Displays the next posts page link. - **Name:** core/query-pagination-next - **Category:** design -- **Supports:** color (gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label ## Page Numbers @@ -595,7 +595,7 @@ Displays the previous posts page link. - **Name:** core/query-pagination-previous - **Category:** design -- **Supports:** color (gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label ## Query Title @@ -604,7 +604,7 @@ Display the query title. - **Name:** core/query-title - **Category:** theme -- **Supports:** align (full, wide), color (gradients), spacing (margin), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), color (background, gradients, text), spacing (margin), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** level, textAlign, type ## Quote @@ -631,7 +631,7 @@ Help visitors find your content. - **Name:** core/search - **Category:** widgets -- **Supports:** align (center, left, right), color (gradients), ~~html~~ +- **Supports:** align (center, left, right), color (background, gradients, text), ~~html~~ - **Attributes:** buttonPosition, buttonText, buttonUseIcon, label, placeholder, showLabel, width, widthUnit ## Separator @@ -667,7 +667,7 @@ Describe in a few words what the site is about. The tagline can be used in searc - **Name:** core/site-tagline - **Category:** theme -- **Supports:** align (full, wide), color (gradients), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Site Title @@ -676,7 +676,7 @@ Displays the name of this site. Update the block, and the changes apply everywhe - **Name:** core/site-title - **Category:** theme -- **Supports:** align (full, wide), color (gradients, link), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), color (background, gradients, link, text), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** isLink, level, linkTarget, textAlign ## Social Icon @@ -712,7 +712,7 @@ Create structured content in rows and columns to display information. - **Name:** core/table - **Category:** text -- **Supports:** align, anchor, color (gradients), typography (fontSize, lineHeight) +- **Supports:** align, anchor, color (background, gradients, text), typography (fontSize, lineHeight) - **Attributes:** body, caption, foot, hasFixedLayout, head ## Table of Contents @@ -748,7 +748,7 @@ Display the description of categories, tags and custom taxonomies when viewing a - **Name:** core/term-description - **Category:** theme -- **Supports:** align (full, wide), color (link), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), color (background, link, text), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** textAlign ## Text Columns (deprecated) @@ -766,7 +766,7 @@ Insert poetry. Use special spacing formats. Or quote song lyrics. - **Name:** core/verse - **Category:** text -- **Supports:** anchor, color (gradients, link), spacing (padding), typography (fontSize, lineHeight) +- **Supports:** anchor, color (background, gradients, link, text), spacing (padding), typography (fontSize, lineHeight) - **Attributes:** content, textAlign ## Video From 816d1c4623189a81a2927b67a3bfaf28b3f99c6c Mon Sep 17 00:00:00 2001 From: Marcus Kazmierczak Date: Mon, 20 Dec 2021 10:45:27 -0800 Subject: [PATCH 5/7] Add info notice about strikeouts --- docs/reference-guides/core-blocks.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index ab6dec3728050..7a04a72ca2cbe 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -2,6 +2,10 @@ This page lists the core blocks included in the block-library package. +
+Items marked with a strikeout (~~strikeout~~) are explicitly disabled. +
+ ## Archives From 4440532647b33ba5714743d3007965398d4cfc01 Mon Sep 17 00:00:00 2001 From: Marcus Kazmierczak Date: Mon, 20 Dec 2021 11:25:11 -0800 Subject: [PATCH 6/7] Update docs with latest rebase --- docs/reference-guides/core-blocks.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 7a04a72ca2cbe..cf17da4da1b20 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -166,11 +166,20 @@ Contains the block elements used to render a comment, like the title, date, auth Displays a paginated navigation to next/previous set of comments, when applicable. - **Name:** core/comments-pagination -- **Category:** design +- **Category:** theme - **Supports:** align, color (background, gradients, link, text), ~~html~~, ~~reusable~~ - **Attributes:** paginationArrow -## Comments Pagination Numbers +## Next Page + +Displays the next comments page link. + +- **Name:** core/comments-pagination-next +- **Category:** theme +- **Supports:** color (background, gradients, ~~text~~), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ +- **Attributes:** label + +## Page Numbers Displays a list of page numbers for comments pagination. @@ -239,7 +248,7 @@ Combine blocks into a group. - **Name:** core/group - **Category:** design -- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), spacing (padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, wide), anchor, color (background, gradients, link, text), spacing (blockGap, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** tagName, templateLock ## Heading From 5ab985a3cc0a82384a7ebadeba28f0ba83b8879f Mon Sep 17 00:00:00 2001 From: Marcus Kazmierczak Date: Mon, 20 Dec 2021 12:44:29 -0800 Subject: [PATCH 7/7] Load JSON using require() --- bin/api-docs/gen-block-lib-list.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/api-docs/gen-block-lib-list.js b/bin/api-docs/gen-block-lib-list.js index 7ae5b99e753da..52add5e45a2d5 100644 --- a/bin/api-docs/gen-block-lib-list.js +++ b/bin/api-docs/gen-block-lib-list.js @@ -130,8 +130,7 @@ function augmentSupports( supports ) { * @return {string} markdown */ function readBlockJSON( filename ) { - const data = fs.readFileSync( filename, 'utf8' ); - const blockjson = JSON.parse( data ); + const blockjson = require( filename ); const supportsAugmented = augmentSupports( blockjson.supports ); const supportsList = processObjWithInnerKeys( supportsAugmented );