In this SharePoint modern tutorial, we will discuss everything about the SharePoint Online Code snippet web part and how to add and configure the code snippet web part.
The Code snippet web part is not available in SharePoint Server 2019.
What is SharePoint Online Code snippet web part?
- Using the Code snippet web part, we can easily show the code on our SharePoint page, when we add the code snippet web part to the SharePoint page by default it shows javascript code language with the dark theme.
- We cannot execute the code in the code snippet web part, it is used to display the code on the modern SharePoint page.
- TypeScript, SQL, Scala, Python, Powershell, Objective C, Markdown, Javascript, Java, HTML, Go, Diff, CSS, C#, C++, and C. These are the programming language that we can display in the code snippet web part.
- We can also change the theme in the code snippet web part, we can add a single line code or multi-lines of code.
- Code snippet web is available both in the modern SharePoint team site and communication sites. The Code snippet web part is not available in SharePoint Server 2019.
Also read, SharePoint Highlighted content web part
How to add Code snippet web part in SharePoint online
Let us see how to add and edit a Code snippet web part in the modern SharePoint,
- Open the SharePoint site page -> Select Edit Page of the SharePoint site page.
- Click on the + circled icon to add a Section layout -> Choose the Code snippet web part.
In the below screenshot, we can see the code snippet web part is added. If we edit the code snippet web part we can see the option to wrap code lines.
This is how we can add and edit a code snippet web part in the modern SharePoint online.
Read SharePoint Online Weather Web Part
SharePoint online code snippet web part features
Let us discuss what are features available in the Code snippet web part in the modern SharePoint,
We can select the following programming language, that we want to display in the code snippet web part, TypeScript, SQL, Scala, Python, Powershell, Objective C, Markdown, Javascript, Java, HTML, Go, Diff, CSS, C#, C++, and C.
- We can also select the Numbered lines or Unnumbered lines in the code snippet web part, we can add a single line code or multi-lines of code.
- If we want to display code with a line number, then we can select the numbered lines option else we can select the unnumbered lines option. By default, it will be in numbered lines option.
- We can also change the theme in the code snippet web part, By default, it will be in Dark theme mode.
- Select Republish to save your changes.
- Once the modern SharePoint page is published, we cannot modify the code available in the code snippet web part.
The below screenshot displays the Numbered lines in the SharePoint online code snippet web part.
The below screenshot displays the Unnumbered lines in the SharePoint online code snippet web part.
The below screenshot displays the Dark theme of the code snippet web part in modern SharePoint.
The below screenshot displays the Light theme of the code snippet web part in modern SharePoint.
These are some features available in the Code snippet web part in the modern SharePoint.
Related SharePoint web part tutorials:
- SharePoint Image Gallery Web Part
- SharePoint Quick Links Web Part
- How to use File viewer web part in SharePoint Online
- SharePoint News Web Part
- SharePoint Hero Web Part
- SharePoint Online Page properties web part
In this SharePoint modern tutorial, we learned what is a SharePoint Online Code snippet web part. We also learned about the code snippet web part features in the modern SharePoint online.
After working for more than 15 years in Microsoft technologies like SharePoint, Office 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (9 times). I have also worked in companies like HP, TCS, KPIT, etc.
I have sharepoint 365 corpotsativo and when using code snippet the code is not rendered, the code is still seen.
email: [email protected]
thank you