Skip to content

Commit

Permalink
Merge pull request #55 from candy-kingdom/feature/44-cref-fix
Browse files Browse the repository at this point in the history
Refine `cref` handling
  • Loading branch information
joshua-light authored Dec 17, 2023
2 parents 3256f2a + b99212f commit d38d215
Show file tree
Hide file tree
Showing 96 changed files with 922 additions and 385 deletions.
15 changes: 0 additions & 15 deletions docs/DocCommentLink.md

This file was deleted.

43 changes: 0 additions & 43 deletions docs/DocMethod.md

This file was deleted.

29 changes: 0 additions & 29 deletions docs/DocType.md

This file was deleted.

13 changes: 0 additions & 13 deletions docs/RenderMarkdownPipe.md

This file was deleted.

65 changes: 65 additions & 0 deletions docs/Summary.Caching.CrefCache.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# [Summary.Caching.CrefCache](../src/Core/Caching/CrefCache.cs#L9)
```cs
public static partial class CrefCache
```

A cache of different `cref` conversions.

## Methods
### [AsCref(string)](../src/Core/Caching/CrefCache.cs#L30)
```cs
public static string AsCref(this string self)
```

Converts the given string into the format of `cref` attribute value.

#### Example
In the following example, the `"Some<T1, T2>"` string
(which represents the name of some type)
is converted into `"Some{T1,T2}"` as if it was a value of a link
(e.g., <see cref="Some{T1,T2}">):
```cs
var a = "Some<T1, T2>";
var b = a.AsCref();
<br/>
b.Should().Be("Some{T1,T2}");
```

### [AsRawCref(string)](../src/Core/Caching/CrefCache.cs#L51)
```cs
public static string AsRawCref(this string self)
```

Converts the given string into the format of `cref` attribute value
but also removes all generic parameter names.

#### Example
In the following example, the `"Some<T1, T2>"` string
(which represents the name of some type)
is converted into `"Some{,}"`, the raw form of `cref` that can be used for comparisons
without involving generic type parameter names.
```cs
var a = "Some<T1, T2>";
var b = a.AsCref();
<br/>
b.Should().Be("Some{,}");
```

### [FromCref(string)](../src/Core/Caching/CrefCache.cs#L73)
```cs
public static string FromCref(this string self)
```

Converts the given string from the format of `cref` attribute value.

#### Example
In the following example, the `"Some{T1,T2}"` string
(which represents the name of some type in the `cref` format)
is converted into `"Some<T1, T2>` so that it can be displayed somewhere.
```cs
var a = "Some{T1,T2}";
var b = a.AsCref();
<br/>
b.Should().Be("Some<T1, T2>");
```

File renamed without changes.
10 changes: 5 additions & 5 deletions docs/Doc.md → docs/Summary.Doc.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
# [Summary.Doc](../src/Core/Doc.cs#L7)
# [Summary.Doc](../src/Core/Doc.cs#L9)
```cs
public record Doc(DocMember[] Members)
```

A document parsed from the source code or an assembly.

## Fields
### [Empty](../src/Core/Doc.cs#L12)
### [Empty](../src/Core/Doc.cs#L14)
```cs
public static readonly Doc Empty
```

An empty document.

## Properties
### [Members](../src/Core/Doc.cs#L7)
### [Members](../src/Core/Doc.cs#L9)
```cs
public DocMember[] Members { get; }
```

The sequence of members this doc contains.

## Methods
### [Merge(Doc, Doc)](../src/Core/Doc.cs#L19)
### [Merge(Doc, Doc)](../src/Core/Doc.cs#L21)
```cs
public static Doc Merge(Doc a, Doc b)
```
Expand All @@ -33,7 +33,7 @@ Merges two documents together returning the new merged document.
- `a`: The first document to merge.
- `b`: The second document to merge.

### [Declaration(DocType?<DocType>)](../src/Core/Doc.cs#L24)
### [Declaration(DocType?<DocType>)](../src/Core/Doc.cs#L29)
```cs
public DocTypeDeclaration? Declaration(DocType? type)
```
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public record DocCommentElement(string Name, DocCommentElementAttribute[] Attributes, DocCommentNode[] Nodes) : DocCommentNode
```

A [`DocCommentNode`](./DocCommentNode.md) that represents a compound element (e.g. summary, remarks, and other XML elements).
A [`DocCommentNode`](./Summary.DocCommentNode.md) that represents a compound element (e.g. summary, remarks, and other XML elements).

_Each element can contain simple text as well as other elements._

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public record DocCommentInheritDoc(string? Cref) : DocCommentNode
```

A [`DocCommentNode`](./DocCommentNode.md) that inherits documentation from another member
A [`DocCommentNode`](./Summary.DocCommentNode.md) that inherits documentation from another member
(`<inheritdoc>`).

## Properties
Expand Down
22 changes: 22 additions & 0 deletions docs/Summary.DocCommentLink.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# [Summary.DocCommentLink](../src/Core/DocCommentLink.cs#L9)
```cs
public record DocCommentLink(DocMember? Member, string Value) : DocCommentNode
```

A [`DocCommentNode`](./Summary.DocCommentNode.md) that represents the link to other member (e.g. `<see cref="SomeMember"/>`).

## Properties
### [Member](../src/Core/DocCommentLink.cs#L9)
```cs
public DocMember? Member { get; }
```

The doc member the link references to.

### [Value](../src/Core/DocCommentLink.cs#L9)
```cs
public string Value { get; }
```

The name of the member the link links to.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public record DocCommentLiteral(string Value, string LeadingTrivia = "") : DocCommentNode
```

A [`DocCommentNode`](./DocCommentNode.md) that represents a literal value (e.g. text, space, newline character, etc.).
A [`DocCommentNode`](./Summary.DocCommentNode.md) that represents a literal value (e.g. text, space, newline character, etc.).

_Literals are simple tokens that are parsed as text._

Expand All @@ -28,5 +28,5 @@ The leading trivia of the literal that is not included in the `Value`(i.e. space
public static DocCommentLiteral New(string value)
```

Constructs a new [`DocCommentLiteral`](./DocCommentLiteral.md) from the given string.
Constructs a new [`DocCommentLiteral`](./Summary.DocCommentLiteral.md) from the given string.

File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public record DocCommentParamRef(string Value) : DocCommentNode
```

A [`DocCommentNode`](./DocCommentNode.md) that represents the reference to a parameter
A [`DocCommentNode`](./Summary.DocCommentNode.md) that represents the reference to a parameter
(`<paramref>`, `<typeparamref>`).

## Properties
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/DocEvent.md → docs/Summary.DocEvent.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
public record DocEvent : DocMember
```

A [`DocMember`](./DocMember.md) that represents a documented event in the parsed source code.
A [`DocMember`](./Summary.DocMember.md) that represents a documented event in the parsed source code.

_Similar to [`DocProperty`](./DocProperty.md) but with its own set of accessors._
_Similar to [`DocProperty`](./Summary.DocProperty.md) but with its own set of accessors._

## Properties
### [Type](../src/Core/DocEvent.cs#L14)
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/DocField.md → docs/Summary.DocField.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public record DocField : DocMember
```

A [`DocMember`](./DocMember.md) that represents a documented field in the parsed source code.
A [`DocMember`](./Summary.DocMember.md) that represents a documented field in the parsed source code.

## Properties
### [Type](../src/Core/DocField.cs#L11)
Expand Down
2 changes: 1 addition & 1 deletion docs/DocIndexer.md → docs/Summary.DocIndexer.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
public record DocIndexer : DocProperty
```

A [`DocProperty`](./DocProperty.md) that represents an indexer.
A [`DocProperty`](./Summary.DocProperty.md) that represents an indexer.

## Properties
### [Params](../src/Core/DocIndexer.cs#L11)
Expand Down
File renamed without changes.
Loading

0 comments on commit d38d215

Please sign in to comment.