Skip to content

Commit d8845e6

Browse files
committed
CodeBlock using Specified Collection Tag .Code
Addionally change the way code block titles are being handled and made a specified collection tag specifically for it, it can be used with the .highlight system under code.scss or it can be used separately as a standalone example without using the CodeBlock, with the copy button and a few other features.
1 parent be43fe4 commit d8845e6

14 files changed

Lines changed: 36 additions & 36 deletions

docs/Language/C++/Addresses.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If not, please refer to the [C++](/docs/Language/C++/C++.html) section of this b
1616

1717
In C++, the ampersand (`&`) symbol is the address-of operator, used to obtain the memory address of a variable. The memory address represents the location in the computer's memory where the variable is stored.
1818

19-
{: .example }
19+
{: .code}
2020
```cpp
2121
int someVar = 69;
2222
int* somePtr = &someVar; // Pointer now holds the address of someVar
@@ -25,7 +25,7 @@ int value = *somePtr; // Retrieves the value stored at the memory address
2525

2626
The memory address is typically represented as a hexadecimal number.
2727

28-
{: .example }
28+
{: .code}
2929
```cpp
3030
#include <iostream>
3131

docs/Language/C++/C++.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Simply create a new C++ source file (typically with a .cpp extension) using your
9595

9696
Here's a simple "Hello, World!" program:
9797

98-
{: .example }
98+
{: .code }
9999
```cpp
100100
#include <iostream>
101101

@@ -114,7 +114,7 @@ Save your C++ code with a meaningful filename and the .cpp extension.
114114

115115
Use the command-line interface or the IDE to compile your C++ code, using GCC:
116116

117-
{: .example }
117+
{: .code }
118118
```bash
119119
g++ your_program.cpp -o your_program
120120
```

docs/Language/C++/ConstantPointerToConstant.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If not, please refer to the [C++](/docs/Language/C++/C++.html) section of this b
1616

1717
Constant Pointers To Constants are a C++ pointer type that cannot be used to modify the value it points to, and the pointer itself cannot be reassigned to point to a different memory location. This provides a high level of const-correctness and is often used to indicate that both the pointer and the pointed-to value are constant.
1818

19-
{: .example }
19+
{: .code }
2020
```cpp
2121
int someVar = 69;
2222
const int* const constPointerToConst = &someVar;
@@ -35,7 +35,7 @@ It offers several benefits:
3535
- When used in function parameters or class member functions, const pointers to const contribute to designing safer interfaces by indicating that the function/method will not modify the input data.
3636
- Allows the compiler to make certain optimizations based on the const-correctness, potentially leading to more efficient code.
3737

38-
{: .example }
38+
{: .code }
3939
```cpp
4040
#include <iostream>
4141

docs/Language/C++/ConstantPointers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If not, please refer to the [C++](/docs/Language/C++/C++.html) section of this b
1616

1717
Constant Pointers are quite straightforward - as with any other standard `const` variable in C++, it's a type of pointer that cannot be reassigned to point to a different memory address. It still allows read-write access to the pointed-to variable though!
1818

19-
{: .example }
19+
{: .code }
2020
```cpp
2121
int someVar = 69;
2222
int* const constPointer = &someVar;
@@ -34,7 +34,7 @@ It offers a few benefits:
3434
- When used in function parameters or class member functions, const pointers contribute to designing safer interfaces by indicating that the function/method will not modify the pointer itself, offering const-correctness.
3535
- Allows the compiler to make certain optimizations based on const-correctness, potentially leading to more efficient code.
3636

37-
{: .example }
37+
{: .code }
3838
```cpp
3939
#include <iostream>
4040

docs/Language/C++/Dereferencing.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ If not, please refer to the [C++](/docs/Language/C++/C++.html) section of this b
1616

1717
The dereference operator (`*`) is used to access the value at the memory address stored in a pointer.
1818

19-
{: .example }
19+
{: .code }
2020
```cpp
2121
int someValue = *somePtr; // Retrieves the value stored at the memory address
2222
```
2323

2424
Dereferencing also allows you to modify the value stored at the memory address.
2525

26-
{: .example }
26+
{: .code }
2727
```cpp
2828
int someVar = 420;
2929
int* somePtr = &someVar;
@@ -32,7 +32,7 @@ int* somePtr = &someVar;
3232

3333
When working with pointers to class members, the `->` operator is often used for dereferencing.
3434

35-
{: .example }
35+
{: .code }
3636
```cpp
3737
class SomeClass
3838
{
@@ -47,7 +47,7 @@ ptr->someData = 69; // Dereferencing using the -> operator to access class memb
4747

4848
Dereferencing is often combined with pointer arithmetic to manipulate arrays, flags, or other blocks of data.
4949

50-
{: .example }
50+
{: .code }
5151
```cpp
5252
int main()
5353
{

docs/Language/C++/MemberPointers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If not, please refer to the [C++](/docs/Language/C++/C++.html) section of this b
1616

1717
Member Pointers are traditional pointers that point to class or struct members.
1818

19-
{: .example }
19+
{: .code }
2020
```cpp
2121
class SomeClass
2222
{

docs/Language/C++/MultilevelPointers.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ While these types of pointers provide flexibility, they can make code more error
2424

2525
A regular pointer is a single-level pointer, pointing directly to a variable.
2626

27-
{: .example }
27+
{: .code }
2828
```cpp
2929
int someVar = 69;
3030
int* singlePointer = &someVar; // Single-level pointer
3131
```
3232

3333
A double-pointer stores the address of another pointer.
3434

35-
{: .example }
35+
{: .code }
3636
```cpp
3737
int someVar = 69;
3838
int* singlePointer = &someVar;
@@ -41,7 +41,7 @@ int** doublePointer = &singlePointer; // Double-level pointer
4141

4242
A triple-pointer is a pointer that stores the address of a double-pointer.
4343

44-
{: .example }
44+
{: .code }
4545
```cpp
4646
int myValue = 69;
4747
int* singlePointer = &someVar;
@@ -51,7 +51,7 @@ int*** triplePointer = &doublePointer; // Triple-level pointer
5151

5252
Each level of indirection requires an additional dereference to access the actual value that is being pointed to by the pointer "below" it.
5353

54-
{: .example }
54+
{: .code }
5555
```cpp
5656
int someVar = 69;
5757
int* singlePointer = &someVar;
@@ -63,7 +63,7 @@ int value = ***triplePointer; // Accesses the value (69) through triple indirec
6363

6464
Multilevel pointers are commonly used in dynamic memory allocation scenarios.
6565

66-
{: .example }
66+
{: .code }
6767
```cpp
6868
int*** MakeTriplePointer()
6969
{
@@ -100,7 +100,7 @@ Multilevel pointers are also useful for handling arrays of pointers or for guard
100100
> "There are readability concerns for sure. As for it being a guard, _kind of, I guess?_ The main issue is that the API's are templated, so it is already kind of expecting to return a `float*` or `int*` or whatever, which, in my opinion is totally legit - guarding, like you said. But, if the array is an array of points to BEGIN with, you're left with the `**` nonsense."
101101
> _- [@Tom Shinton](www.tomshinton.com), Discussion about Multilevel Pointer use-cases._
102102
103-
{: .example }
103+
{: .code }
104104
```cpp
105105
#include <iostream>
106106

docs/Language/C++/NullPointers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ If not, please refer to the [C++](/docs/Language/C++/C++.html) section of this b
1818

1919
Initializing a pointer without assigning it a specific address sets it to a null pointer.
2020

21-
{: .example }
21+
{: .code }
2222
```cpp
2323
int* nullPointer = nullptr;
2424
```
@@ -27,7 +27,7 @@ Note that a `nullptr` is not implicitly convertible to integral types, which hel
2727

2828
Checking or Guarding for invalid pointers frequently in your code is good practice, especially when writing critical programs.
2929

30-
{: .example }
30+
{: .code }
3131
```cpp
3232
class SomeClass
3333
{

docs/Language/C++/PointerToConstant.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ If not, please refer to the [C++](/docs/Language/C++/C++.html) section of this b
1616

1717
Pointers To Constants in C++ are pointers that can have their memory address reassigned, but cannot be used to modify the value they point to (just like a standard `const` variable). The target is flexible, but the pointed-to value cannot be modified!
1818

19-
{: .example }
19+
{: .code }
2020
```cpp
2121
int someVar = 69;
2222
const int* pointerToConst = &someVar;
@@ -33,7 +33,7 @@ It offers a few benefits:
3333
- When used in function parameters or class member functions, a pointer to const indicates that the function/method will not modify the input data, offering safer interfaces.
3434
- Allows the compiler to make certain optimizations based on const-correctness, potentially leading to more efficient code.
3535

36-
{: .example }
36+
{: .code }
3737
```cpp
3838
#include <iostream>
3939

docs/Language/C++/Pointers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ In C++, pointers are variables that store references to memory addresses of othe
2020

2121
Imagine that pointers are like "signposts" that tell you where an object is in a box, rather than being a copy of the object - when there are several thousand objects floating around, the advantages are clear and can help to ensure operations occur on the correct object reference!
2222

23-
{: .example }
23+
{: .code }
2424
```cpp
2525
#include <iostream>
2626

0 commit comments

Comments
 (0)