You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AngleSharp and its libraries uses features from the latest versions of C# (e.g., C# 7). You will therefore need a C# compiler that is up for the job.
36
39
37
40
1. Fork and clone the repo.
38
-
2. First try to build the AngleSharp.Core libray and see if you get the tests running.
41
+
2. First try to build the AngleSharp.Core library and see if you get the tests running.
39
42
3. You will be required to resolve some dependencies via NuGet.
40
43
41
44
AngleSharp itself does not have dependencies, however, the tests are dependent on NUnit.
42
45
43
-
The build system of AngleSharp uses Cake. A bootstrap script (build.ps1 for Windows or build.sh for *nix systems) is included. Note, that at the moment AngleSharp may require NuGet 3.5, which looks for MSBuild pre-15, i.e., before Visual Studio 2017 on Windows systems. We aim to drop this requirement enitirely soon.
46
+
The build system of AngleSharp uses Cake. A bootstrap script (build.ps1 for Windows or build.sh for *nix systems) is included. Note, that at the moment AngleSharp may require NuGet 3.5, which looks for MSBuild pre-15, i.e., before Visual Studio 2017 on Windows systems. We aim to drop this requirement entirely soon.
44
47
45
48
### Code Conventions
46
49
47
50
Most parts in the AngleSharp project are fairly straight forward. Among these are:
48
51
49
-
- Always use statement blocks for control statements, e.g., in a for-loop, if-condition, ...
50
-
- You may use a simple (throw) statement in case of enforcing contracts on argument
51
-
- Be explicit about modifiers (some files follow an older convention of the code base, but we settled on the explicit style)
52
+
* Always use statement blocks for control statements, e.g., in a for-loop, if-condition, ...
53
+
* You may use a simple (throw) statement in case of enforcing contracts on argument
54
+
* Be explicit about modifiers (some files follow an older convention of the code base, but we settled on the explicit style)
52
55
53
56
There are a couple of rules, which are definitely not standard, but highly recommended for consistency and readability:
54
57
55
-
- AngleSharp uses the RHS convention, where types are always put on the right hand side if possible, i.e., preferring `var` under all circumstances
56
-
- A single empty line between two non-simple statements (e.g., for-loop and if-condition) should be inserted
57
-
- Types are preferred to keywords (`String` instead of `string` or `Int32` instead of `int`)
58
-
-`using` statements must be inside the namespace declaration
58
+
* AngleSharp uses the RHS convention, where types are always put on the right hand side if possible, i.e., preferring `var` under all circumstances
59
+
* A single empty line between two non-simple statements (e.g., for-loop and if-condition) should be inserted
60
+
* Types are preferred to keywords (`String` instead of `string` or `Int32` instead of `int`)
61
+
*`using` statements must be inside the namespace declaration
59
62
60
63
### Development Workflow
61
64
62
65
1. If no issue already exists for the work you'll be doing, create one to document the problem(s) being solved and self-assign.
63
66
2. Otherwise please let us know that you are working on the problem. Regular status updates (e.g. "still in progress", "no time anymore", "practically done", "pull request issued") are highly welcome.
64
-
2. Create a new branch—please don't work in the `master` branch directly. It is reserved for releases. We recommend naming the branch to match the issue being addressed (`feature/#777` or `issue-777`).
65
-
3. Add failing tests for the change you want to make. Tests are crucial and should be taken from W3C (or other specification).
66
-
4. Fix stuff. Always go from edge case to edge case.
67
-
5. All tests should pass now. Also your new implementation should not break existing tests.
68
-
6. Update the documentation to reflect any changes. (or document such changes in the original issue)
69
-
7. Push to your fork or push your issue-specific branch to the main repository, then submit a pull request against `devel`.
67
+
3. Create a new branch—please don't work in the `master` branch directly. It is reserved for releases. We recommend naming the branch to match the issue being addressed (`feature/#777` or `issue-777`).
68
+
4. Add failing tests for the change you want to make. Tests are crucial and should be taken from W3C (or other specification).
69
+
5. Fix stuff. Always go from edge case to edge case.
70
+
6. All tests should pass now. Also your new implementation should not break existing tests.
71
+
7. Update the documentation to reflect any changes. (or document such changes in the original issue)
72
+
8. Push to your fork or push your issue-specific branch to the main repository, then submit a pull request against `devel`.
70
73
71
74
Just to illustrate the git workflow for AngleSharp a little bit more we've added the following graphs.
72
75
@@ -76,19 +79,19 @@ Here we now created a new branch called `devel`. This is the development branch.
76
79
77
80
Now active work is supposed to be done. Therefore a new branch should be created. Let's create one:
78
81
79
-
```
82
+
```sh
80
83
git checkout -b feature/#777
81
84
```
82
85
83
86
There may be many of these feature branches. Most of them are also pushed to the server for discussion or synchronization.
84
87
85
-
```
88
+
```sh
86
89
git push -u origin feature/#777
87
90
```
88
91
89
92
Now feature branches may be closed when they are done. Here we simply merge with the feature branch(es). For instance the following command takes the `feature/#777` branch from the server and merges it with the `devel` branch.
90
93
91
-
```
94
+
```sh
92
95
git checkout devel
93
96
git pull
94
97
git pull origin feature/#777
@@ -97,7 +100,7 @@ git push
97
100
98
101
Finally, we may have all the features that are needed to release a new version of AngleSharp. Here we tag the release. For instance for the 1.0 release we use `v1.0`.
99
102
100
-
```
103
+
```sh
101
104
git checkout master
102
105
git merge devel
103
106
git tag v1.0
@@ -109,12 +112,11 @@ git tag v1.0
109
112
110
113
The following files should not be edited directly in the current repository, but rather in the `AngleSharp.GitBase` repository. They are then synced via `git pull` from a different remote.
AngleSharp.Js comes currently in two flavors: on Windows for .NET 4.6 and in general targetting .NET Standard 2.0 platforms.
10
+
11
+
Most of the features of the library do not require .NET 4.6, which means you could create your own fork and modify it to work with previous versions of the .NET-Framework.
12
+
13
+
You need to have AngleSharp installed already. This could be done via NuGet:
14
+
15
+
```ps1
16
+
Install-Package AngleSharp
17
+
```
18
+
19
+
## Getting AngleSharp.Js over NuGet
20
+
21
+
The simplest way of integrating AngleSharp.Js to your project is by using NuGet. You can install AngleSharp.Js by opening the package manager console (PM) and typing in the following statement:
22
+
23
+
```ps1
24
+
Install-Package AngleSharp.Js
25
+
```
26
+
27
+
You can also use the graphical library package manager ("Manage NuGet Packages for Solution"). Searching for "AngleSharp.Js" in the official NuGet online feed will find this library.
28
+
29
+
## Setting up AngleSharp.Js
30
+
31
+
To use AngleSharp.Js you need to add it to your `Configuration` coming from AngleSharp itself.
32
+
33
+
If you just want a configuration *that works* you should use the following code:
34
+
35
+
```cs
36
+
varconfig=Configuration.Default
37
+
.WithJs(); // from AngleSharp.Js
38
+
```
39
+
40
+
This will register a scripting engine for JS files. The JS parsing options and more could be set with parameters of the `WithJs` method.
41
+
42
+
You can also use this part with a console for logging. The call for this is `WithConsoleLogger`, e.g.,
43
+
44
+
```cs
45
+
varconfig=Configuration.Default
46
+
.WithJs()
47
+
.WithConsoleLogger(ctx=>newMyConsoleLogger(ctx));
48
+
```
49
+
50
+
in the previous example `MyConsoleLogger` refers to a class implementing the `IConsoleLogger` interface. Examples of classes implementing this interface are available in our [samples repository](https://github.com/AngleSharp/AngleSharp.Samples).
0 commit comments