{"id":2019,"date":"2026-08-06T06:15:46","date_gmt":"2026-08-06T06:15:46","guid":{"rendered":"https:\/\/www.vpascode.com\/pt\/docs\/uncategorized\/d2-syntax-basics\/"},"modified":"2026-08-06T06:15:46","modified_gmt":"2026-08-06T06:15:46","slug":"d2-syntax-basics","status":"publish","type":"ld_docs","link":"https:\/\/www.vpascode.com\/pt\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/","title":{"rendered":"No\u00e7\u00f5es B\u00e1sicas da Sintaxe D2"},"content":{"rendered":"<p>O D2 \u00e9 uma ferramenta moderna baseada em texto para criar diagramas claros e leg\u00edveis. Significa &#8220;Diagrama\u00e7\u00e3o Declarativa&#8221;. No VPasCode, o D2 permite que desenvolvedores de software e arquitetos de solu\u00e7\u00f5es transformem texto simples de c\u00f3digo em modelos visuais limpos, sem precisar desenhar formas manualmente.<\/p>\n<div class=\"callout\" style=\"background-color: #f0fdf4; border-left: 4px solid #16a34a; padding: 1rem; border-radius: 4px; margin-bottom: 1.5rem;\"><strong>Dica:<\/strong>A sintaxe do D2 foi projetada para ser simples e f\u00e1cil de ler. Formas, conex\u00f5es, r\u00f3tulos e grupos podem todos ser escritos usando linhas de texto b\u00e1sicas, sem configura\u00e7\u00f5es complexas.<\/div>\n<h2 style=\"font-size: 1.5rem; font-weight: bold; color: #1f2937; margin-top: 2rem; margin-bottom: 1rem; border-left: 4px solid #4f46e5; padding-left: 0.75rem;\">1. Formas B\u00e1sicas e Conex\u00f5es<\/h2>\n<p>Para criar formas, basta digitar seus nomes. Para conectar formas, use uma seta (<code>-&gt;<\/code> para uma dire\u00e7\u00e3o ou <code>&lt;-&gt;<\/code> para duas dire\u00e7\u00f5es).<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">D2<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpdjLEKwkAQRPuD+4cFa7EPYhMRS8lFUm\/OgRzEje7tCf69iSCi1TAzj7eikK63EVRPIoiWJvHunKG03lGHngL0Aa3o2LYnanAvyObd91m4PRv3nFHRARaHd\/fus\/6bGlhRmSOX0fKPazujNccBC8WXTafJQOEp8QX5ZzbN\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Edite o D2 no VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">D2<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpljrEKwjAURfdC\/+GBs7gXcWgVHBykqTjH5IEPYp68JCL+jTj4If0xU+pgcbzce7hnBg17vPcvBkWXq8NQFoeQ+qcQw3wFCuVGlgWOeKpAsSNDUffvAdh23b4sfhcDUWtvGCzCWlsOFdQpGC1jKotp+\/\/QYmTxed9iSC6O0ORimZlGmzNmHfJG2NPjK7RDikn0YhOMZMsPrqZOgA==\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-d2\"><code class=\"language-d2\" data-language=\"d2\" class=\"language-d2\"># Conex\u00e3o Simples\r\nUsu\u00e1rio -&gt; Servidor Web: Solicita\u00e7\u00e3o HTTP\r\nServidor Web -&gt; Banco de Dados: Buscar Dados\r\nBanco de Dados -&gt; Servidor Web: Retornar Resultados\r\nServidor Web &lt;-&gt; Cache: Sincroniza\u00e7\u00e3o Leitura\/Escrita<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpljrEKwjAURfdC\/+GBs7gXcWgVHBykqTjH5IEPYp68JCL+jTj4If0xU+pgcbzce7hnBg17vPcvBkWXq8NQFoeQ+qcQw3wFCuVGlgWOeKpAsSNDUffvAdh23b4sfhcDUWtvGCzCWlsOFdQpGC1jKotp+\/\/QYmTxed9iSC6O0ORimZlGmzNmHfJG2NPjK7RDikn0YhOMZMsPrqZOgA==\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpdjLEKwkAQRPuD+4cFa7EPYhMRS8lFUm\/OgRzEje7tCf69iSCi1TAzj7eikK63EVRPIoiWJvHunKG03lGHngL0Aa3o2LYnanAvyObd91m4PRv3nFHRARaHd\/fus\/6bGlhRmSOX0fKPazujNccBC8WXTafJQOEp8QX5ZzbN\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Edite o D2 no VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"fTwbVMr\"><img fetchpriority=\"high\" alt=\"D2 simple connection diagram showing request and response flows between User, Web Server, Database, and Cache - Text to diagram editor - VPasCode\" class=\"alignnone wp-image-1923 size-full\" decoding=\"async\" fetchpriority=\"high\" height=\"642\" sizes=\"(max-width: 535px) 100vw, 535px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527.png 535w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527-250x300.png 250w\" width=\"535\"\/><\/p>\n<h2 style=\"font-size: 1.5rem; font-weight: bold; color: #1f2937; margin-top: 2rem; margin-bottom: 1rem; border-left: 4px solid #4f46e5; padding-left: 0.75rem;\">2. Tipos de Formas e R\u00f3tulos Personalizados<\/h2>\n<p>Por padr\u00e3o, as formas aparecem como caixas padr\u00e3o. Voc\u00ea pode facilmente alterar o tipo de \u00edcone de uma forma ou definir um r\u00f3tulo personalizado usando a propriedade <code>shape<\/code> propriedade.<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">D2<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpdjkEKwjAQRfeB3OFTN7rwAlm40CwVWuIFpu1YB2JakigU8e4SKELdvv\/g\/Q0s3yRIGODuNDGu88RJq5MXDtngrRWQymIwcUxj0OqjVRHGZw\/H8SUdp7XYlW3xLiQB9vgnzF5Cz7EgTy17g6qO8qA4w1KmlhJjW48pD5Fdc95Vv2q5hf0B634hS+kLMeE\/Sw==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Edite o D2 no VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">D2<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNp1jjEOwjAMRfdIuYNVFhi4AAMDVEwIFZULmMSApTSOktIFcR4OwsVIpC4V6mZ9\/\/f\/X0BNN\/bsrcCFgySwBAeJHSat9o7J97SBl1YA6YEh34FSEtTqrZVWLcWBv5+MUQen50Dd1OyLNHp36I2U+BptBprI3nBANyUMuzwmSpEcXim\/qzkSlo2k\/h6pPR9X1Vgzjob1Fv7XFXUu7Qc6a1Vn\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-d2\"><code class=\"language-d2\" data-language=\"d2\" class=\"language-d2\"># Definindo Tipos de Formas\r\nCliente: {\r\n  shape: pessoa\r\n}\r\n\r\nServi\u00e7os em Nuvem: {\r\n  shape: nuvem\r\n}\r\n\r\nBanco de Dados Principal: {\r\n  shape: cilindro\r\n  label: \"Banco de Dados Principal (PostgreSQL)\"\r\n}\r\n\r\nCliente -&gt; Servi\u00e7os em Nuvem -&gt; Banco de Dados Principal<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNp1jjEOwjAMRfdIuYNVFhi4AAMDVEwIFZULmMSApTSOktIFcR4OwsVIpC4V6mZ9\/\/f\/X0BNN\/bsrcCFgySwBAeJHSat9o7J97SBl1YA6YEh34FSEtTqrZVWLcWBv5+MUQen50Dd1OyLNHp36I2U+BptBprI3nBANyUMuzwmSpEcXim\/qzkSlo2k\/h6pPR9X1Vgzjob1Fv7XFXUu7Qc6a1Vn\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpdjkEKwjAQRfeB3OFTN7rwAlm40CwVWuIFpu1YB2JakigU8e4SKELdvv\/g\/Q0s3yRIGODuNDGu88RJq5MXDtngrRWQymIwcUxj0OqjVRHGZw\/H8SUdp7XYlW3xLiQB9vgnzF5Cz7EgTy17g6qO8qA4w1KmlhJjW48pD5Fdc95Vv2q5hf0B634hS+kLMeE\/Sw==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Edite o D2 no VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"GQAkWLQ\"><img alt=\"D2 custom shapes showing person, cloud, and database cylinder icons linked in sequence - Text to diagram editor - VPasCode\" class=\"alignnone wp-image-1924 size-full\" decoding=\"async\" height=\"670\" sizes=\"(max-width: 470px) 100vw, 470px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d444e3dd.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d444e3dd.png 470w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d444e3dd-210x300.png 210w\" width=\"470\"\/><\/p>\n<h2 style=\"font-size: 1.5rem; font-weight: bold; color: #1f2937; margin-top: 2rem; margin-bottom: 1rem; border-left: 4px solid #4f46e5; padding-left: 0.75rem;\">3. Defini\u00e7\u00f5es de Classe<\/h2>\n<p>O D2 suporta nativamente o design de estruturas orientadas a objetos usando a forma <code>class<\/code> forma.<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">D2<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpFyTsKgDAMANC90Dtk1Ctkq07OniC0QQP9SFNdxLtLcXB9bz61lcTVeV\/O3BBuawB0p4MRfCRVa7rQ90tAWFuVvHXkRBJdCJVVf+8j6nyTi4cRYSolMmVrnheKDyJB\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Edite o D2 no VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">D2<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpFyTEKgDAMQNG90Dtk1Ct0007OniC0QQM1FRNdxLtrJ7fP+7GKYSxMYhTg9g5AV9y\/TgVVvWuCKdVTbMoBZjtYloa0IZch54NUf2+HdUjGF3V9gLHWQijePS\/0PiDb\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-d2\"><code class=\"language-d2\" data-language=\"d2\" class=\"language-d2\">ContaCliente: {\r\n  shape: class\r\n\r\n  accountId: String\r\n  emailAddress: String\r\n\r\n  isActive(): Boolean\r\n}<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpFyTEKgDAMQNG90Dtk1Ct0007OniC0QQM1FRNdxLtrJ7fP+7GKYSxMYhTg9g5AV9y\/TgVVvWuCKdVTbMoBZjtYloa0IZch54NUf2+HdUjGF3V9gLHWQijePS\/0PiDb\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpFyTsKgDAMANC90Dtk1Ctkq07OniC0QQP9SFNdxLtLcXB9bz61lcTVeV\/O3BBuawB0p4MRfCRVa7rQ90tAWFuVvHXkRBJdCJVVf+8j6nyTi4cRYSolMmVrnheKDyJB\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Edite o D2 no VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"xQUTaiD\"><img alt=\"D2 class diagram displaying CustomerAccount properties and isActive method - Text to diagram editor - VPasCode\" class=\"alignnone wp-image-1925 size-full\" decoding=\"async\" height=\"432\" sizes=\"(max-width: 522px) 100vw, 522px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d4d8bc24.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d4d8bc24.png 522w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d4d8bc24-300x248.png 300w\" width=\"522\"\/><\/p>\n<h2 style=\"font-size: 1.5rem; font-weight: bold; color: #1f2937; margin-top: 2rem; margin-bottom: 1rem; border-left: 4px solid #4f46e5; padding-left: 0.75rem;\">4. Cont\u00eaineres Aninhados (Agrupamento)<\/h2>\n<p>O D2 torna f\u00e1cil agrupar itens juntos dentro de cont\u00eaineres usando chaves padr\u00e3o (&#8220;<code>{}<\/code>). Voc\u00ea tamb\u00e9m pode vincular elementos entre grupos diferentes usando a nota\u00e7\u00e3o ponto.<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">D2<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNptj8EKgkAQhu8L+w4DnvUBOgQmJR6k0HqAYZ1sSWZlXJOI3j03OlR4nOH\/5v8mglzc2FtuYbL+Apljj5ZJBq12Mg\/EDaR931mD3jpewUMrgIrQeDgVEK+h9ugJSmRsSbR6aqXVBs01kAWfBQcvo\/Gj0AdODwXkMzPhPfDpOPeW1ogbSG7W0EJmLw3JX+hdFEE2r4a4DV+AccxkgueyffLjGg4viyZf9SuotvURMuy6FxZ4Y5w=\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Edite o D2 no VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">D2<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNqNj01KA0EQhfcNfYcHWZsDZCGMIYZZCCHqAYruUhudrlBdExXxNC4CXmMuZrcIIszCXVFV7+dboLvX8UADZxMEGbCWbNNnyqxcvOsOTymQpaPgUuuFc1zhzTvgtseeKRjOzrGtzzkkiqKIjE2xOnr37p13fb5T4mI62qiECwqPvyZbMn6m1ybqdn2zukpBpbAe03SS7\/1YQ62WmE7Th\/xTtOOYopSfCosGxS9VjmqljIYs83TLWZYWMg+y\/NtmhfUDDRQJ+831zReM6XjZ\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-d2\"><code class=\"language-d2\" data-language=\"d2\" class=\"language-d2\"># Agrupamento com Cont\u00eaineres\r\nAplicativo Frontend: {\r\n  UI React -&gt; Gerenciador de Estado\r\n}\r\n\r\nInfraestrutura Backend: {\r\n  Gateway de API -&gt; Microservi\u00e7o de Autentica\u00e7\u00e3o\r\n  Gateway de API -&gt; Microservi\u00e7o de Pedidos\r\n}\r\n\r\n# Conex\u00e3o entre grupos\r\nAplicativo Frontend.Gerenciador de Estado -&gt; Infraestrutura Backend.Gateway de API: Chamada REST<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNqNj01KA0EQhfcNfYcHWZsDZCGMIYZZCCHqAYruUhudrlBdExXxNC4CXmMuZrcIIszCXVFV7+dboLvX8UADZxMEGbCWbNNnyqxcvOsOTymQpaPgUuuFc1zhzTvgtseeKRjOzrGtzzkkiqKIjE2xOnr37p13fb5T4mI62qiECwqPvyZbMn6m1ybqdn2zukpBpbAe03SS7\/1YQ62WmE7Th\/xTtOOYopSfCosGxS9VjmqljIYs83TLWZYWMg+y\/NtmhfUDDRQJ+831zReM6XjZ\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNptj8EKgkAQhu8L+w4DnvUBOgQmJR6k0HqAYZ1sSWZlXJOI3j03OlR4nOH\/5v8mglzc2FtuYbL+Apljj5ZJBq12Mg\/EDaR931mD3jpewUMrgIrQeDgVEK+h9ugJSmRsSbR6aqXVBs01kAWfBQcvo\/Gj0AdODwXkMzPhPfDpOPeW1ogbSG7W0EJmLw3JX+hdFEE2r4a4DV+AccxkgueyffLjGg4viyZf9SuotvURMuy6FxZ4Y5w=\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Edite o D2 no VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"XvKRcme\"><img loading=\"lazy\" alt=\"D2 nested containers grouping Frontend Application and Backend Infrastructure modules - Text to diagram editor - VPasCode\" class=\"alignnone wp-image-1926 size-full\" decoding=\"async\" height=\"987\" loading=\"lazy\" sizes=\"auto, (max-width: 674px) 100vw, 674px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d5828bfa.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d5828bfa.png 674w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d5828bfa-205x300.png 205w\" width=\"674\"\/><\/p>\n<h2 style=\"font-size: 1.5rem; font-weight: bold; color: #1f2937; margin-top: 2rem; margin-bottom: 1rem; border-left: 4px solid #4f46e5; padding-left: 0.75rem;\">5. Estilo e Cores<\/h2>\n<p>Cores de fundo personalizadas, cores de tra\u00e7o e estilos de fonte podem ser personalizados diretamente dentro do bloco usando a palavra-chave<code>style<\/code>palavra-chave.<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">D2<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNoLTi0qy0xOVXC0Uqjm5VJQKC6pzEmFshUU0jJzcqwUlJRTDVLN09KUIILFJUX52akgYRNjY4vkRKhwUn5RSmqRblFiSmZpsZWCBUi0lpcLiHi5gqG2OOG1JS01zTjZHMOWFEtzcwMzJWzmOSro2ikgGR6cmpei4JtaXJyYngoAKgc5Cw==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Edite o D2 no VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">D2<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNoLTi0qyzy8PF\/B0UqhmpdLQaG4pDInFcpWUEjLzMmxUlBSTjVINU9LU4IIFpcU5WengoRNjI0tkhOhwkn5RSmpRbpFiSmZpcVWChYg0VpeLiDi5QqGWeOE15q01DTjZHMMa1Iszc0NzJSwGuiooGungGy8a15ZZmKRgm9qXnFiemouAPzUPpI=\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-d2\"><code class=\"language-d2\" data-language=\"d2\" class=\"language-d2\">Servi\u00e7o A: {\r\n  style: {\r\n    fill: \"#e0e7ff\"\r\n    stroke: \"#4338ca\"\r\n    border-radius: 8\r\n  }\r\n}\r\n\r\nServi\u00e7o B: {\r\n  style: {\r\n    fill: \"#fef3c7\"\r\n    stroke: \"#d97706\"\r\n  }\r\n}\r\n\r\nServi\u00e7o A -&gt; Servi\u00e7o B: Enviar Mensagem<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNoLTi0qyzy8PF\/B0UqhmpdLQaG4pDInFcpWUEjLzMmxUlBSTjVINU9LU4IIFpcU5WengoRNjI0tkhOhwkn5RSmpRbpFiSmZpcVWChYg0VpeLiDi5QqGWeOE15q01DTjZHMMa1Iszc0NzJSwGuiooGungGy8a15ZZmKRgm9qXnFiemouAPzUPpI=\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNoLTi0qy0xOVXC0Uqjm5VJQKC6pzEmFshUU0jJzcqwUlJRTDVLN09KUIILFJUX52akgYRNjY4vkRKhwUn5RSmqRblFiSmZpsZWCBUi0lpcLiHi5gqG2OOG1JS01zTjZHMOWFEtzcwMzJWzmOSro2ikgGR6cmpei4JtaXJyYngoAKgc5Cw==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Edite o D2 no VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"ZKCxIsS\"><img loading=\"lazy\" alt=\"D2 styled blocks showing custom background colors and border styles for Service A and Service B - Text to diagram editor - VPasCode\" class=\"alignnone wp-image-1927 size-full\" decoding=\"async\" height=\"455\" loading=\"lazy\" sizes=\"auto, (max-width: 313px) 100vw, 313px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d6582049.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d6582049.png 313w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d6582049-206x300.png 206w\" width=\"313\"\/><\/p>\n<h2 style=\"font-size: 1.5rem; font-weight: bold; color: #1f2937; margin-top: 2rem; margin-bottom: 1rem; border-left: 4px solid #4f46e5; padding-left: 0.75rem;\">6. Folha de Dicas de Sintaxe R\u00e1pida<\/h2>\n<table style=\"width: 100%; border-collapse: collapse; margin-bottom: 1.5rem;\">\n<thead>\n<tr style=\"background-color: #f9fafb;\">\n<th style=\"border: 1px solid #e5e7eb; padding: 0.75rem; text-align: left;\">Conceito<\/th>\n<th style=\"border: 1px solid #e5e7eb; padding: 0.75rem; text-align: left;\">Exemplo de C\u00f3digo<\/th>\n<th style=\"border: 1px solid #e5e7eb; padding: 0.75rem; text-align: left;\">O que faz<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><strong>Conex\u00e3o Direcionada<\/strong><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><code>A -&gt; B<\/code><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\">Desenha uma seta apontando de A para B.<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><strong>R\u00f3tulo da Linha<\/strong><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><code>A -&gt; B: Enviar Dados<\/code><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\">Adiciona texto acima da seta de conex\u00e3o.<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><strong>Seta Bidirecional<\/strong><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><code>A &lt;-&gt; B<\/code><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\">Desenha uma seta apontando em ambas as dire\u00e7\u00f5es.<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><strong>Cont\u00eaineres \/ Grupos<\/strong><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><code>Servidor: { ... }<\/code><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\">Agrupa v\u00e1rias formas em uma \u00fanica caixa.<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><strong>Sele\u00e7\u00e3o de Forma<\/strong><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><code>forma: cilindro<\/code><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\">Transforma a caixa padr\u00e3o em um \u00edcone de banco de dados, pessoa, nuvem, classe, etc.<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><strong>Coment\u00e1rios<\/strong><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><code># Meu coment\u00e1rio<\/code><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\">Coment\u00e1rios de uma linha ignorados durante a renderiza\u00e7\u00e3o.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>O D2 \u00e9 uma ferramenta moderna baseada em texto para criar diagramas claros e leg\u00edveis. Significa &#8220;Diagrama\u00e7\u00e3o Declarativa&#8221;. No VPasCode, o D2 permite que desenvolvedores de software e arquitetos de solu\u00e7\u00f5es transformem texto simples de c\u00f3digo em modelos visuais limpos,&#8230;<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":0,"menu_order":0,"template":"","meta":{"inline_featured_image":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}}},"ld_collection":[14],"class_list":["post-2019","ld_docs","type-ld_docs","status-publish","hentry","ld_collection-vpascode-docs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>D2 Syntax | Text to diagram tool - VPasCode<\/title>\n<meta name=\"description\" content=\"Master D2 declarative diagramming in VPasCode. Easily build cloud architecture diagrams, ERDs, and workflow charts directly from simple code snippets.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vpascode.com\/pt\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/\" \/>\n<meta property=\"og:locale\" content=\"pt_PT\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"D2 Syntax | Text to diagram tool - VPasCode\" \/>\n<meta property=\"og:description\" content=\"Master D2 declarative diagramming in VPasCode. Easily build cloud architecture diagrams, ERDs, and workflow charts directly from simple code snippets.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vpascode.com\/pt\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/\" \/>\n<meta property=\"og:site_name\" content=\"VPasCode\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Tempo estimado de leitura\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/\",\"name\":\"D2 Syntax | Text to diagram tool - VPasCode\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.vpascode.com\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/img_6a742d37a7527.png\",\"datePublished\":\"2026-08-06T06:15:46+00:00\",\"description\":\"Master D2 declarative diagramming in VPasCode. Easily build cloud architecture diagrams, ERDs, and workflow charts directly from simple code snippets.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/#breadcrumb\"},\"inLanguage\":\"pt-PT\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-PT\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/img_6a742d37a7527.png\",\"contentUrl\":\"https:\\\/\\\/www.vpascode.com\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/img_6a742d37a7527.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Lean Docs\",\"item\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/docs\\\/%ld_collection%\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"No\u00e7\u00f5es B\u00e1sicas da Sintaxe D2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/#website\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/\",\"name\":\"VPasCode\",\"description\":\"by Visual Paradigm\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"pt-PT\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/#organization\",\"name\":\"VPasCode\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"pt-PT\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/wp-content\\\/uploads\\\/sites\\\/10\\\/2026\\\/06\\\/cropped-vp-online-logo-v1.png\",\"contentUrl\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/wp-content\\\/uploads\\\/sites\\\/10\\\/2026\\\/06\\\/cropped-vp-online-logo-v1.png\",\"width\":128,\"height\":138,\"caption\":\"VPasCode\"},\"image\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/pt\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"D2 Syntax | Text to diagram tool - VPasCode","description":"Master D2 declarative diagramming in VPasCode. Easily build cloud architecture diagrams, ERDs, and workflow charts directly from simple code snippets.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vpascode.com\/pt\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/","og_locale":"pt_PT","og_type":"article","og_title":"D2 Syntax | Text to diagram tool - VPasCode","og_description":"Master D2 declarative diagramming in VPasCode. Easily build cloud architecture diagrams, ERDs, and workflow charts directly from simple code snippets.","og_url":"https:\/\/www.vpascode.com\/pt\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/","og_site_name":"VPasCode","og_image":[{"url":"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Tempo estimado de leitura":"3 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vpascode.com\/pt\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/","url":"https:\/\/www.vpascode.com\/pt\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/","name":"D2 Syntax | Text to diagram tool - VPasCode","isPartOf":{"@id":"https:\/\/www.vpascode.com\/pt\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.vpascode.com\/pt\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/#primaryimage"},"image":{"@id":"https:\/\/www.vpascode.com\/pt\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/#primaryimage"},"thumbnailUrl":"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527.png","datePublished":"2026-08-06T06:15:46+00:00","description":"Master D2 declarative diagramming in VPasCode. Easily build cloud architecture diagrams, ERDs, and workflow charts directly from simple code snippets.","breadcrumb":{"@id":"https:\/\/www.vpascode.com\/pt\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/#breadcrumb"},"inLanguage":"pt-PT","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vpascode.com\/pt\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/"]}]},{"@type":"ImageObject","inLanguage":"pt-PT","@id":"https:\/\/www.vpascode.com\/pt\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/#primaryimage","url":"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527.png","contentUrl":"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.vpascode.com\/pt\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vpascode.com\/pt\/"},{"@type":"ListItem","position":2,"name":"Lean Docs","item":"https:\/\/www.vpascode.com\/pt\/docs\/%ld_collection%\/"},{"@type":"ListItem","position":3,"name":"No\u00e7\u00f5es B\u00e1sicas da Sintaxe D2"}]},{"@type":"WebSite","@id":"https:\/\/www.vpascode.com\/pt\/#website","url":"https:\/\/www.vpascode.com\/pt\/","name":"VPasCode","description":"by Visual Paradigm","publisher":{"@id":"https:\/\/www.vpascode.com\/pt\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vpascode.com\/pt\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"pt-PT"},{"@type":"Organization","@id":"https:\/\/www.vpascode.com\/pt\/#organization","name":"VPasCode","url":"https:\/\/www.vpascode.com\/pt\/","logo":{"@type":"ImageObject","inLanguage":"pt-PT","@id":"https:\/\/www.vpascode.com\/pt\/#\/schema\/logo\/image\/","url":"https:\/\/www.vpascode.com\/pt\/wp-content\/uploads\/sites\/10\/2026\/06\/cropped-vp-online-logo-v1.png","contentUrl":"https:\/\/www.vpascode.com\/pt\/wp-content\/uploads\/sites\/10\/2026\/06\/cropped-vp-online-logo-v1.png","width":128,"height":138,"caption":"VPasCode"},"image":{"@id":"https:\/\/www.vpascode.com\/pt\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.vpascode.com\/pt\/wp-json\/wp\/v2\/ld_docs\/2019","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vpascode.com\/pt\/wp-json\/wp\/v2\/ld_docs"}],"about":[{"href":"https:\/\/www.vpascode.com\/pt\/wp-json\/wp\/v2\/types\/ld_docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.vpascode.com\/pt\/wp-json\/wp\/v2\/users\/3"}],"wp:attachment":[{"href":"https:\/\/www.vpascode.com\/pt\/wp-json\/wp\/v2\/media?parent=2019"}],"wp:term":[{"taxonomy":"ld_collection","embeddable":true,"href":"https:\/\/www.vpascode.com\/pt\/wp-json\/wp\/v2\/ld_collection?post=2019"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}