Skip to content

Commit 14bf592

Browse files
committed
Adding extra styling, fixing unflattening code sample
1 parent 2e29098 commit 14bf592

File tree

4 files changed

+32
-1
lines changed

4 files changed

+32
-1
lines changed

docs/src/Object-Unflattening.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ For example, this Dictionary:
1212
var dictionary = new Dictionary<string, object>
1313
{
1414
["Name"] = "Mrs Customer"
15-
["Dob"] = * DateTime 1985/11/05 *
15+
["Dob"] = new DateTime(1985, 11, 05),
1616
["Address.Line1"] = "1 Street"
1717
["Address.Postcode"] = "XY3 8HW"
1818
};

docs/src/css/styles.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,7 @@ li.current {
5252
border-top: 1px solid #010101;
5353
border-bottom: 1px solid #010101;
5454
}
55+
56+
.hljs-type, .hljs-keyword, .hljs-title {
57+
font-weight: normal;
58+
}

docs/src/scripts/docs.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
$(document).ready(function () {
2+
var hlCode = document.querySelectorAll('pre code.cs'),
3+
i,
4+
hlLength = hlCode.length,
5+
mapperRegex = new RegExp('\\bMapper\\b', 'g'),
6+
typeRegex = new RegExp('(new</span>\\W+|class</span> <span class="hljs-title">|&lt;)([A-Z][^&\\\( ]+)( |{|\\\(|&gt;)', 'g'),
7+
genericTypeRegex = new RegExp('(IDictionary|Dictionary|IEnumerable|IReadOnlyCollection|Collection|List)&lt;', 'g'),
8+
observer = new MutationObserver(function (mutations) {
9+
for (var mutation of mutations) {
10+
if (mutation.attributeName === 'class') {
11+
var innerHTML = mutation.target.innerHTML
12+
.replace(mapperRegex, '<span class="hljs-type">Mapper</span>')
13+
.replace(typeRegex, '$1<span class="hljs-type">$2</span>$3')
14+
.replace(genericTypeRegex, '<span class="hljs-type">$1</span>&lt;');
15+
mutation.target.innerHTML = innerHTML;
16+
}
17+
}
18+
}),
19+
config = { attributes: true };
20+
21+
for (i = 0; i < hlLength; ++i) {
22+
observer.observe(hlCode[i], config);
23+
}
24+
});

mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ extra_css:
1010
- https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/vs2015.min.css
1111
- css/styles.css
1212

13+
extra_javascript:
14+
- scripts/docs.js
15+
1316
nav:
1417
- General Use:
1518
- Member matching: Member-Matching.md

0 commit comments

Comments
 (0)