Manual Snippets Syntax highlighter [Example - paste.ac / FAQ]

01/01/2001  •  130 views
 
This will separate the plain text and code snippets in your paste. But to make this work, you have to separate it manually example code block 1:
<!DOCTYPE html>
<html>
<head>
 <meta charset="utf-8">
 <title>www.paste.ac</title>
 <style>
 body {
 margin:auto;
 max-width:780px;
 padding:20px;
 }
 a {
 color:#6457fc;
 text-decoration:none;
 }
 a:hover {
 color:#ff9000;
 text-decoration:none; 
 }
 </style>
</head>
<body>

 <p>All of your pasted content will be highlighted with the code syntax highlighter, including if there is plain text in it.</p> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
 $("button").click(function(){
 $("p").hide(1000);
 alert("The paragraph is now hidden");
 });
});
</script>
</body>
</html>
example code block 2:
local pm = GetProjectManager();
if (IsNull(pm))
{
 ShowError(_T("Could not query the project manager. Cannot continue."));
 return 0;
}

local p = pm.GetActiveProject();

// File with the source files separated by \n
// for example:
// '''''''''''''''''''
// a.cpp
// b.cpp
// '''''''''''''''''''
local filecontent = IO.ReadFileContents (_T("D:\\ddddd\\fileList.txt"));

// Split the files in lines
local fileList = GetArrayFromString(filecontent, _T("\n"), true);
print(_T("Files to load:"));
for(local i = 0; i < fileList.GetCount(); i++)
{
	print(fileList.Item(i) + _T("\n")); // Print the files in the list, as a check
}

// Base path, the files in the text files are relative in my case. If they are absolute you can remove this
local basePath = _T("D:\\ddddd\\src\\");
for(local i = 0; i < fileList.GetCount(); i++)
{
 // Create file path
	local filePath = basePath + fileList.Item(i);
	// Add to all build targets
	for(local a = 0; a <= p.GetBuildTargetsCount(); a++)
 pm.AddFileToProject(filePath, p, a);
}
// Save the project. This triggers also an update of the project UI
pm.SaveAllProjects();
 English / Indonesian