Skip to content

Commit

Permalink
Adding extra styling, fixing unflattening code sample
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveWilkes committed Dec 1, 2018
1 parent 2e29098 commit 14bf592
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/src/Object-Unflattening.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For example, this Dictionary:
var dictionary = new Dictionary<string, object>
{
["Name"] = "Mrs Customer"
["Dob"] = * DateTime 1985/11/05 *
["Dob"] = new DateTime(1985, 11, 05),
["Address.Line1"] = "1 Street"
["Address.Postcode"] = "XY3 8HW"
};
Expand Down
4 changes: 4 additions & 0 deletions docs/src/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@ li.current {
border-top: 1px solid #010101;
border-bottom: 1px solid #010101;
}

.hljs-type, .hljs-keyword, .hljs-title {
font-weight: normal;
}
24 changes: 24 additions & 0 deletions docs/src/scripts/docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$(document).ready(function () {
var hlCode = document.querySelectorAll('pre code.cs'),
i,
hlLength = hlCode.length,
mapperRegex = new RegExp('\\bMapper\\b', 'g'),
typeRegex = new RegExp('(new</span>\\W+|class</span> <span class="hljs-title">|&lt;)([A-Z][^&\\\( ]+)( |{|\\\(|&gt;)', 'g'),
genericTypeRegex = new RegExp('(IDictionary|Dictionary|IEnumerable|IReadOnlyCollection|Collection|List)&lt;', 'g'),
observer = new MutationObserver(function (mutations) {
for (var mutation of mutations) {
if (mutation.attributeName === 'class') {
var innerHTML = mutation.target.innerHTML
.replace(mapperRegex, '<span class="hljs-type">Mapper</span>')
.replace(typeRegex, '$1<span class="hljs-type">$2</span>$3')
.replace(genericTypeRegex, '<span class="hljs-type">$1</span>&lt;');
mutation.target.innerHTML = innerHTML;
}
}
}),
config = { attributes: true };

for (i = 0; i < hlLength; ++i) {
observer.observe(hlCode[i], config);
}
});
3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ extra_css:
- https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.13.1/styles/vs2015.min.css
- css/styles.css

extra_javascript:
- scripts/docs.js

nav:
- General Use:
- Member matching: Member-Matching.md
Expand Down

0 comments on commit 14bf592

Please sign in to comment.