From 14bf592d6f85d30b064c2563d90e4cc4aa18befd Mon Sep 17 00:00:00 2001 From: Steve Wilkes Date: Sat, 1 Dec 2018 11:20:05 +0000 Subject: [PATCH] Adding extra styling, fixing unflattening code sample --- docs/src/Object-Unflattening.md | 2 +- docs/src/css/styles.css | 4 ++++ docs/src/scripts/docs.js | 24 ++++++++++++++++++++++++ mkdocs.yml | 3 +++ 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 docs/src/scripts/docs.js diff --git a/docs/src/Object-Unflattening.md b/docs/src/Object-Unflattening.md index 18a035e2a..5cf2ae440 100644 --- a/docs/src/Object-Unflattening.md +++ b/docs/src/Object-Unflattening.md @@ -12,7 +12,7 @@ For example, this Dictionary: var dictionary = new Dictionary { ["Name"] = "Mrs Customer" - ["Dob"] = * DateTime 1985/11/05 * + ["Dob"] = new DateTime(1985, 11, 05), ["Address.Line1"] = "1 Street" ["Address.Postcode"] = "XY3 8HW" }; diff --git a/docs/src/css/styles.css b/docs/src/css/styles.css index d6f1e0a5e..b0a7029d0 100644 --- a/docs/src/css/styles.css +++ b/docs/src/css/styles.css @@ -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; +} diff --git a/docs/src/scripts/docs.js b/docs/src/scripts/docs.js new file mode 100644 index 000000000..700d9e3fa --- /dev/null +++ b/docs/src/scripts/docs.js @@ -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\\W+|class |<)([A-Z][^&\\\( ]+)( |{|\\\(|>)', 'g'), + genericTypeRegex = new RegExp('(IDictionary|Dictionary|IEnumerable|IReadOnlyCollection|Collection|List)<', 'g'), + observer = new MutationObserver(function (mutations) { + for (var mutation of mutations) { + if (mutation.attributeName === 'class') { + var innerHTML = mutation.target.innerHTML + .replace(mapperRegex, 'Mapper') + .replace(typeRegex, '$1$2$3') + .replace(genericTypeRegex, '$1<'); + mutation.target.innerHTML = innerHTML; + } + } + }), + config = { attributes: true }; + + for (i = 0; i < hlLength; ++i) { + observer.observe(hlCode[i], config); + } +}); \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index e79bbae51..6bf9a53fa 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -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