{"id":42385042,"url":"https://github.com/happyprime/block-margin","last_synced_at":"2026-01-27T22:51:32.538Z","repository":{"id":43092401,"uuid":"344590874","full_name":"happyprime/block-margin","owner":"happyprime","description":"A WordPress plugin that adds margin controls to blocks.","archived":false,"fork":false,"pushed_at":"2025-05-19T13:15:58.000Z","size":1019,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"develop","last_synced_at":"2025-12-01T04:42:56.708Z","etag":null,"topics":["gutenberg","gutenberg-blocks","gutenberg-plugin","wordpress","wordpress-plugin"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/happyprime.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-04T19:47:20.000Z","updated_at":"2025-05-19T13:14:20.000Z","dependencies_parsed_at":"2023-11-16T22:54:07.056Z","dependency_job_id":"0956d42a-7554-4290-81b0-434d7f5d18d0","html_url":"https://github.com/happyprime/block-margin","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/happyprime/block-margin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happyprime%2Fblock-margin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happyprime%2Fblock-margin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happyprime%2Fblock-margin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happyprime%2Fblock-margin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/happyprime","download_url":"https://codeload.github.com/happyprime/block-margin/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/happyprime%2Fblock-margin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28826322,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-27T18:44:20.126Z","status":"ssl_error","status_checked_at":"2026-01-27T18:44:09.161Z","response_time":168,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gutenberg","gutenberg-blocks","gutenberg-plugin","wordpress","wordpress-plugin"],"created_at":"2026-01-27T22:51:31.251Z","updated_at":"2026-01-27T22:51:32.532Z","avatar_url":"https://github.com/happyprime.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Block Margin\n\nBlock Margin is a WordPress plugin that adds margin controls to blocks.\n\nWhen a margin option is selected, a `has-{selected option}-margin-top` class is added to the block.\n\n## Filters\n\nA number of filters are provided to afford developers control over which blocks to include the margin controls on and which margin options to make available.\n\n### blockMargin.excludedBlocks\n\nA filter used to control which blocks to exclude the margin controls from. It receives an empty array as an argument - all blocks include the controls by default. This filter should return an array of block names.\n\nHere's an example which removes the controls from the core Latest Posts block:\n\n```JavaScript\n/**\n * Exclude margin controls from the core Latest Posts block.\n *\n * @return {array} Blocks to exclude margin controls from.\n */\nfunction excludeMarginControlsFromBlocks() {\n\treturn [ 'core/latest-posts' ];\n}\n\naddFilter(\n\t'blockMargin.excludedBlocks',\n\t'myprefix/blockMargin/excludeBlocks',\n\texcludeMarginControlsFromBlocks,\n);\n```\n\n### blockMargin.controls\n\nA filter used to control the options allowed in the controls. It receives an object of default options in the following format as an argument, and should return an object using the same format.\n\n```javascript\n{\n\tzero: {\n\t\ticon: marginZero,\n\t\ttitle: __( 'Add zero top margin' ),\n\t},\n\tsmall: {\n\t\ticon: marginSmall,\n\t\ttitle: __( 'Add small top margin' ),\n\t},\n\tmedium: {\n\t\ticon: marginMedium,\n\t\ttitle: __( 'Add medium top margin' ),\n\t},\n\tlarge: {\n\t\ticon: marginLarge,\n\t\ttitle: __( 'Add large top margin' ),\n\t},\n\tlarger: {\n\t\ticon: marginLarger,\n\t\ttitle: __( 'Add larger top margin' ),\n\t},\n}\n```\n\nHere's an example which removes the `Larger` option from, and adds a `Huge` option to, the controls:\n\n```JavaScript\n/**\n * Filter the margin control options.\n *\n * @param  {Object} defaults Default options.\n * @return {Object} Modified options.\n */\nfunction filterBlockMarginControls( defaults ) {\n\t// Remove the `Larger` control options.\n\tdelete defaults.larger;\n\n\t// Add a `Huge` control option.\n\tdefaults.huge = {\n\t\ticon: { \u003csvg ...\u003e...\u003c/svg\u003e },\n\t\ttitle: __( 'Add huge top margin' ),\n\t};\n\n\treturn defaults;\n}\n\naddFilter(\n\t'blockMargin.controls',\n\t'myprefix/blockMargin/controls',\n\tfilterBlockMarginControls,\n);\n```\n\n### block_margin_excluded_blocks\n\nA PHP filter used to control which server-side blocks to exclude the margin controls from. It receives an empty array as an argument - all blocks include the controls by default. This filter should return an array of block names.\n\nThis filter probably doesn't need to be used, but it can be used in conjunction with its respective JavaScript filter if you need to be sure the `margin` attribute is not added to a given server-side block.\n\nHere's an example for making sure the core Latest Post block is excluded from the `margin` attribute registration:\n\n```PHP\nadd_filter( 'block_margin_excluded_blocks', 'exclude_margin_from_latest_posts_block' );\n/**\n * Prevent the `margin` attribute from being added to the Latest Post block.\n */\nfunction exclude_margin_from_latest_posts_block() {\n\treturn array( 'core/latest-posts' );\n}\n```\n\n### block_margin_options\n\nA filter used to control the options allowed in the controls for server-side blocks. It receives an array of the default option names as an argument and should return an array of option names.\n\nThis filter should be used in conjunction with its respective JavaScript filter to ensure that the margin options are synced with server-side blocks - perhaps most importantly when adding options.\n\nFollowing the example given for the JavaScript filter:\n\n```PHP\nadd_filter( 'block_margin_options', 'filter_block_margin_options' );\n/**\n * Filter the `margin` options available to server-side blocks.\n */\nfunction filter_block_margin_options( $defaults ) {\n\t// Remove the `larger` option.\n\tunset( $defaults['larger'] );\n\n\t// Add a `huge` option.\n\t$defaults[] = 'huge';\n\n\treturn $defaults;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappyprime%2Fblock-margin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhappyprime%2Fblock-margin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhappyprime%2Fblock-margin/lists"}