Skip to content

Commit 4cccdb3

Browse files
committed
Added a README.md
Added a README.md and an image for the README. This README is a simple way of informing the user on how to use the extension when they are editing a wiki-page.
1 parent ae83244 commit 4cccdb3

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# MultiCodeBlock
2+
Creates a codeblock consisting of multiple languages and a special way of commenting the code.
3+
4+
![The MultiCodeBlock itself](./img/MultiCodeBlockPreview.png "A preview of the MultiCodeBlock")
5+
6+
## How it works
7+
8+
The input is structured in a HTML-Style:
9+
* `<multicodeblock>` - This is the main body of the codeblock and directly calls `MultiCodeBlock::renderMultiCodeBlock` by MediaWiki
10+
* `<codeblock lang="<language>">"` - These are the different codeblocks (languages). The order of these codeblocks decides the order in the navigation. The `language` is the filetype and not the name of the programming language itself, but it is possible to use the name.
11+
* `<code>` - This is the code itself and is going to be highlighted.
12+
* `<desc>` - The description is a block of different blocks of the description.
13+
* `<position line="<line-number>">` - The positions are holding the description itself the the starting point of the description (relative to the code). It is possible to write in Wiki-Syntax in these.
14+
15+
So it would be something like this:
16+
```html
17+
<multicodeblock>
18+
<codeblock lang="cpp">
19+
<code>
20+
#include <iostream>
21+
22+
int main() {
23+
std::cout << "Hello, World!" << std::endl;
24+
25+
return 0;
26+
}
27+
</code>
28+
<desc>
29+
<position line="3">
30+
'''This''' is the <code>main</code>-function
31+
</position>
32+
<position line="5">
33+
Here stops everything.
34+
</position>
35+
</desc>
36+
</multicodeblock>
37+
```
38+
39+
Currently the tabs in the code are rendered in the browser and so there shouldn't be and unnecessary tabs. This creates the break in the `<code>`-block.
40+
41+
----
42+
43+
This codeblock is an element where the different versions of the code are accessible through a navigation on the left side.
44+
The codeblocks itself are a table that has the code on the left side and the comments on the right side. The Code is seperated into rows with a simple ordered list that starts on each table cell with a specific value.
45+
46+
To avoid problems with selecting the code there are two ways of copying it: The first way is the raw selection that is made possible with JavaScript and the constant removal and addition of the `user-select: none;` css property and the second way is by clicking the button on the right side that is copying the code and is directly adding it into the clipboard.
47+
48+
## License
49+
The project is licensed under the permissive Apache 2.0 License.

img/MultiCodeBlockPreview.png

22.4 KB
Loading

0 commit comments

Comments
 (0)