{"id":15274,"date":"2025-06-24T17:19:04","date_gmt":"2025-06-24T11:19:04","guid":{"rendered":"https:\/\/betterdocs.co\/?post_type=docs&#038;p=15274"},"modified":"2025-07-03T16:19:00","modified_gmt":"2025-07-03T10:19:00","password":"","slug":"configure-code-snippet-in-betterdocs","status":"publish","type":"docs","link":"https:\/\/betterdocs.co\/it\/docs\/configure-code-snippet-in-betterdocs\/","title":{"rendered":"How to Configure Code Snippet in BetterDocs?"},"content":{"rendered":"<p>To create IT documentation, tools, or plugins that require various coding languages, a code snippet feature is essential, allowing users to easily copy and implement the code. With <a href=\"http:\/\/wpdeveloper.net\/plugins\/betterdocs\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>BetterDocs<\/strong><\/a> &#039;<strong>Code Snippet\u2019 <\/strong>feature, you can not only implement code snippets into your documentation but also customize them and make them look more stylish.&nbsp;<\/p>\n\n\n\n<p>Adding a code snippet in your documentation requires a few simple steps with BetterDocs. Learn how to configure it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step-by-Step Guide to Configure Code Snippet in BetterDocs<\/h2>\n\n\n\n<p>Follow these step-by-step instructions to find out how you can use<strong> \u2018Code Snippet\u2019<\/strong> to design your Single Doc in Gutenberg or Elementor.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Add Code Snippet to Your Documentation<\/h3>\n\n\n\n<p>Navigate to BetterDocs and your preferred document where you want to add the <strong>\u2018Code Snippet\u2019<\/strong>. If you are using the Gutenberg editor, click on the <strong>\u2018+\u2019<\/strong> icon and search for the <strong>\u2018BetterDocs Code Snippet\u2019<\/strong> block. Drag and drop the block to the place where you want to show the snippet.&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1366\" height=\"599\" src=\"https:\/\/betterdocs.co\/wp-content\/uploads\/2025\/06\/image-16.gif\" alt=\"Configure Code Snippet: Add The Block\" class=\"wp-image-15322\" title=\"\"><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\"><strong>Step 2: Add Code and Customize the Snippet<\/strong><\/h3>\n\n\n\n<p>Next, you can add the code and customize the snippet inside the documentation. From the right sidebar, choose the programming language that you want to insert. After that, in the code snippet field, paste your code. Here, based on your preferred programming language, the syntax colour will be changed.&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"1366\" height=\"599\" src=\"https:\/\/betterdocs.co\/wp-content\/uploads\/2025\/06\/image-17.gif\" alt=\"Configure Code Snippet: Choose Code Language\" class=\"wp-image-15323\" title=\"\"><\/figure>\n<\/div>\n\n\n<p>Next, from the<strong> \u2018Appearance\u2019 <\/strong>option, choose how you want to display the snippet in your document. You will be able to show your snippet in <strong>\u2018Light\u2019<\/strong> o <strong>\u2018Dark\u2019<\/strong> mode. Also, you can enable or disable the <strong>\u2018Header Bar\u2019<\/strong>, <strong>\u2018Copy Button\u2019<\/strong>, <strong>\u2018Copy Tooltip\u2019<\/strong> e <strong>show\/ hide the line numbers.<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"1366\" height=\"599\" src=\"https:\/\/betterdocs.co\/wp-content\/uploads\/2025\/06\/image-18.gif\" alt=\"Configure Code Snippet: Change the Appearance\" class=\"wp-image-15324\" title=\"\"><\/figure>\n<\/div>\n\n\n<p>Quindi, dal <strong>\u2018File Preview Header\u2019<\/strong>, choose your preferred name for the snippet, show or hide the window buttons and language icon. Here, you can also add a custom icon for the snippet block.&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1363\" height=\"596\" src=\"https:\/\/betterdocs.co\/wp-content\/uploads\/2025\/06\/image-19.gif\" alt=\"Configure Code Snippet: Customize File Preview\" class=\"wp-image-15325\" title=\"\"><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\">Step 3: Choose Different Styles for The Code Snippet<\/h3>\n\n\n\n<p>Next, you can customize and add different styling options in your code snippet block. From the <strong>\u2018Wrapper\u2019<\/strong> dropdown menu, you can choose the margin and padding of the block. There with the background type, you can set <strong>\u2018Background Color\u2019 <\/strong>e<strong> \u2018Border Color\u2019<\/strong>. Also, you can choose different border widths and radius for the snippet.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1366\" height=\"599\" src=\"https:\/\/betterdocs.co\/wp-content\/uploads\/2025\/06\/image-20.gif\" alt=\"Configure Code Snippet: Choose style\" class=\"wp-image-15326\" title=\"\"><\/figure>\n<\/div>\n\n\n<p>After that, to show the code in your document in a stylish format, you can add background color inside the snippet and typography to the code from the <strong>\u2018Header\u2019<\/strong>. In this option, you can also customize the copy button color and file name color for the snippet.&nbsp;&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1366\" height=\"599\" src=\"https:\/\/betterdocs.co\/wp-content\/uploads\/2025\/06\/image-21.gif\" alt=\"Configure Code Snippet: Customize the header section\" class=\"wp-image-15327\" title=\"\"><\/figure>\n<\/div>\n\n\n<p>Dal <strong>\u2018Code Content Option\u2019,<\/strong> you can choose your preferred padding and background color inside the snippet.&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1366\" height=\"599\" src=\"https:\/\/betterdocs.co\/wp-content\/uploads\/2025\/06\/image-22.gif\" alt=\"Configure Code Snippet: Customize the code content\" class=\"wp-image-15328\" title=\"\"><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">How to Add the \u2018Code Snippet\u2019 in Elementor?<\/h2>\n\n\n\n<p>If you prefer your documentation in Elementor, then you can implement this similarly with the <strong>\u2018\u2018BetterDocs Code Snippet\u2019<\/strong> <strong>&#039; <\/strong>widget. For that, you need to add a single doc first. Know how to configure the single doc page on Elementor <a href=\"https:\/\/betterdocs.co\/it\/docs\/single-doc-in-elementor\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>from the documentation<\/strong><\/a>.<\/p>\n\n\n\n<p><strong><em>Nota:<\/em><\/strong><em> To configure single docs for Elementor, you need the <strong><a href=\"https:\/\/wpdeveloper.com\/go\/elementor\" target=\"_blank\" rel=\"noreferrer noopener\">Elementor PR<\/a><\/strong><a href=\"https:\/\/wpdeveloper.com\/go\/elementor\" target=\"_blank\" rel=\"noopener\">O<\/a> version.<\/em><\/p>\n\n\n\n<p>Once you have configured the single doc, open it in Elementor. Search for <strong>\u2018\u2018BetterDocs Code Snippet\u2019<\/strong> in the elements\u2019 search panel, then drag and drop it to your document to get the code snippet for the doc.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1366\" height=\"599\" src=\"https:\/\/betterdocs.co\/wp-content\/uploads\/2025\/06\/image-23.gif\" alt=\"Configure Code Snippet: Add code snippet in Elementor\" class=\"wp-image-15329\" title=\"\"><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\"><strong>Esito finale<\/strong><\/h2>\n\n\n\n<p>Finally, in your single document, you can see the code snippet as you wanted in your documentation.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1349\" height=\"565\" src=\"https:\/\/betterdocs.co\/wp-content\/uploads\/2025\/06\/image-24.gif\" alt=\"Final outcome of code snippet\" class=\"wp-image-15330\" title=\"\"><\/figure>\n<\/div>\n\n\n<p>That is how you can configure a code snippet and show the code stunningly on your website.&nbsp;<br>Still have some questions? Do not forget to contact our <a href=\"https:\/\/wpdeveloper.net\/support\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>team di supporto<\/strong><\/a>.<\/p>","protected":false},"excerpt":{"rendered":"<p>Learn how to add code snippet in your document with BetterDocs and how to customize it inside the documents.<\/p>","protected":false},"author":44,"featured_media":15365,"template":"","meta":{"_eb_attr":"","inline_featured_image":false,"_eb_data_table":"","_analytify_skip_tracking":false,"footnotes":""},"doc_category":[309],"doc_tag":[],"knowledge_base":[282],"class_list":["post-15274","docs","type-docs","status-publish","has-post-thumbnail","hentry","doc_category-configurations","knowledge_base-wordpress"],"year_month":"2026-04","word_count":578,"total_views":"2702","reactions":{"happy":"9","normal":"1","sad":"4"},"author_info":{"name":"Maahi","author_nicename":"maahi","author_url":"https:\/\/betterdocs.co\/it\/author\/maahi\/"},"doc_category_info":[{"term_name":"Configurations","term_url":"https:\/\/betterdocs.co\/it\/docs\/shopify\/configurations\/"}],"doc_tag_info":[],"knowledge_base_info":[{"term_name":"WordPress","term_url":"https:\/\/betterdocs.co\/it\/docs\/wordpress\/","term_slug":"wordpress"}],"knowledge_base_slug":["wordpress"],"_links":{"self":[{"href":"https:\/\/betterdocs.co\/it\/wp-json\/wp\/v2\/docs\/15274","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/betterdocs.co\/it\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/betterdocs.co\/it\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/betterdocs.co\/it\/wp-json\/wp\/v2\/users\/44"}],"version-history":[{"count":8,"href":"https:\/\/betterdocs.co\/it\/wp-json\/wp\/v2\/docs\/15274\/revisions"}],"predecessor-version":[{"id":15366,"href":"https:\/\/betterdocs.co\/it\/wp-json\/wp\/v2\/docs\/15274\/revisions\/15366"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/betterdocs.co\/it\/wp-json\/wp\/v2\/media\/15365"}],"wp:attachment":[{"href":"https:\/\/betterdocs.co\/it\/wp-json\/wp\/v2\/media?parent=15274"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/betterdocs.co\/it\/wp-json\/wp\/v2\/doc_category?post=15274"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/betterdocs.co\/it\/wp-json\/wp\/v2\/doc_tag?post=15274"},{"taxonomy":"knowledge_base","embeddable":true,"href":"https:\/\/betterdocs.co\/it\/wp-json\/wp\/v2\/knowledge_base?post=15274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}