-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node annotations in DocumentationBrowser #11153
Merged
sm6srw
merged 41 commits into
DynamoDS:master
from
SHKnudsen:Node-annotations-doc-browser
Dec 2, 2020
Merged
Changes from 18 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
561b029
add packageDocManager to handle package documentation links
SHKnudsen 4257141
new viewModelEventArgs to send node annotation data to doc browser
SHKnudsen 1d50fab
Handle node annotation in doc browser
SHKnudsen df7c944
support custom NodeModels + fix watcher event bug
SHKnudsen 0966ef6
Update NodeAnnotationNotFound.md
radumg afb9636
Update NodeAnnotationNotFound.md
radumg 1372265
Comment updates
SHKnudsen 3897991
Update AssemblySharedInfo.cs
SHKnudsen ff33549
Update src/DynamoCoreWpf/ViewModels/Core/DynamoViewModelEventArgs.cs
radumg 03f123c
addtional comment updates + clean up
SHKnudsen acfdaa1
Merge branch 'Node-annotations-doc-browser' of https://github.com/SHK…
SHKnudsen 64793a9
clean up packageDocManager
SHKnudsen 0b81edb
Update DocumentationBrowserViewModel.cs
SHKnudsen ba89de9
Merge branch 'master' into Node-annotations-doc-browser
SHKnudsen 798e777
handle overloads + fix hot reload bug
SHKnudsen 658ef26
use HtmlSanitizer to clean potential dangerous content from markdown …
SHKnudsen 3298bb6
move PackageDocumentationManager to DocumentationBrowser
SHKnudsen ad4ce3a
update syntax highlighting + markdownStyling updates
SHKnudsen df8e1e2
comment updates
SHKnudsen 5f270b5
add Markdig to License files
SHKnudsen 214ff10
Change GetPackageName to GetMainCategory
SHKnudsen 021123a
update markdig + htmlsanitizer version
SHKnudsen 174b8c0
Merge branch 'master' into Node-annotations-doc-browser
SHKnudsen 7790fc1
fix failing tests + add new node documentaion tests
SHKnudsen 9ab1016
Merge branch 'master' into Node-annotations-doc-browser
SHKnudsen d18269f
fix broken test
SHKnudsen 1001be3
update link to wiki
SHKnudsen d5a84fc
Update DocumentationBrowserViewExtension.cs
SHKnudsen 71509da
Add MD2HTML Tool
sm6srw bbefc36
First pass - singleton version
sm6srw 99b42f2
Revert "Add MD2HTML Tool"
sm6srw f655c39
Revert "First pass - singleton version"
sm6srw 7862382
fix test
SHKnudsen 3ce2cc0
add doc folder to PackageDirectoryBuilder (#10)
SHKnudsen c8cf9f3
Use a CLI tool for converting MD to HTML and for Sanitizing HTML as a…
sm6srw 389d6c0
Merge master (#12)
sm6srw b29876e
Merge branch 'master' into Node-annotations-doc-browser
mjkkirschner 8a63d91
Extract more strings (#13)
sm6srw df7a483
Fix failing tests (#14)
sm6srw eac0196
More failing test fixes (#15)
sm6srw a7c7303
Merge branch 'master' into Node-annotations-doc-browser
mjkkirschner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
250 changes: 250 additions & 0 deletions
250
src/DocumentationBrowserViewExtension/Docs/MarkdownStyling.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,250 @@ | ||
<!-- These headers are required to force the browser embedded in the DocumentationBrowser extension to render in modern IE11 mode. --> | ||
<head> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<style> | ||
/* PrismJS 1.21.0 | ||
https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+bash+c+csharp+cpp+ini+java+javadoc+javadoclike+javastacktrace+json+json5+jsonp+jsstacktrace+js-templates+markdown+powershell+python+sql+typescript+typoscript+xml-doc */ | ||
/** | ||
* prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML | ||
* Based on https://github.com/chriskempson/tomorrow-theme | ||
* @author Rose Pritchard | ||
*/ | ||
code[class*=language-], pre[class*=language-] { | ||
color: #ccc; | ||
background: 0 0; | ||
font-family: Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace; | ||
font-size: 1em; | ||
text-align: left; | ||
white-space: pre; | ||
word-spacing: normal; | ||
word-break: normal; | ||
word-wrap: normal; | ||
line-height: 1.5; | ||
-moz-tab-size: 4; | ||
-o-tab-size: 4; | ||
tab-size: 4; | ||
-webkit-hyphens: none; | ||
-moz-hyphens: none; | ||
-ms-hyphens: none; | ||
hyphens: none | ||
} | ||
|
||
pre[class*=language-] { | ||
padding: 1em; | ||
margin: .5em 0; | ||
overflow: auto | ||
} | ||
|
||
:not(pre) > code[class*=language-], pre[class*=language-] { | ||
background: #1e1e1e | ||
} | ||
|
||
:not(pre) > code[class*=language-] { | ||
padding: .1em; | ||
border-radius: .3em; | ||
white-space: normal | ||
} | ||
|
||
.token.block-comment, .token.cdata, .token.comment, .token.doctype, .token.prolog { | ||
color: #999 | ||
} | ||
|
||
.token.punctuation { | ||
color: #ccc | ||
} | ||
|
||
.token.attr-name, .token.deleted, .token.namespace, .token.tag { | ||
color: #e2777a | ||
} | ||
|
||
.token.function-name { | ||
color: #6196cc | ||
} | ||
|
||
.token.boolean, .token.function, .token.number { | ||
color: #f08d49 | ||
} | ||
|
||
.token.class-name, .token.constant, .token.property, .token.symbol { | ||
color: #f8c555 | ||
} | ||
|
||
.token.atrule, .token.builtin, .token.important, .token.keyword, .token.selector { | ||
color: #cc99cd | ||
} | ||
|
||
.token.attr-value, .token.char, .token.regex, .token.string, .token.variable { | ||
color: #7ec699 | ||
} | ||
|
||
.token.entity, .token.operator, .token.url { | ||
color: #67cdcc | ||
} | ||
|
||
.token.bold, .token.important { | ||
font-weight: 700 | ||
} | ||
|
||
.token.italic { | ||
font-style: italic | ||
} | ||
|
||
.token.entity { | ||
cursor: help | ||
} | ||
|
||
.token.inserted { | ||
color: green | ||
} | ||
</style> | ||
<style> | ||
h1{ | ||
margin-top:0; | ||
} | ||
|
||
body { | ||
color: #fff; | ||
font-size: 14px; | ||
font-family: "Artifakt Element"; | ||
src: url(fonts/ArtifaktElement-Regular.woff) format("woff"); | ||
padding: 1%; | ||
background-color: #353535; | ||
font-family: 'Artifakt Element','Open Sans' | ||
} | ||
|
||
a { | ||
color: #d3d3d3; | ||
cursor: pointer; | ||
background-color: transparent | ||
} | ||
|
||
table { | ||
border-collapse: collapse; | ||
border: 1px solid #fff | ||
} | ||
|
||
td, th { | ||
border: 1px solid #fff; | ||
padding-right: 10px; | ||
padding-left: 10px; | ||
padding-bottom: 10px; | ||
padding-top: 10px | ||
} | ||
|
||
samp { | ||
margin-top: 10px; | ||
display: block; | ||
color: #d3d3d3 | ||
} | ||
|
||
thead { | ||
text-align: center | ||
} | ||
|
||
.hidden-lg { | ||
display: none | ||
} | ||
|
||
.table--noborder { | ||
border: none | ||
} | ||
|
||
.table--noborder td, .table--noborder th { | ||
border: none | ||
} | ||
|
||
img { | ||
width: 100%; | ||
height: auto | ||
} | ||
|
||
code, | ||
pre { | ||
color: #ccc; | ||
background: 0 0; | ||
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; | ||
font-size: 1em; | ||
text-align: left; | ||
white-space: pre; | ||
word-spacing: normal; | ||
word-break: normal; | ||
word-wrap: normal; | ||
line-height: 1.5; | ||
-moz-tab-size: 4; | ||
-o-tab-size: 4; | ||
tab-size: 4; | ||
-webkit-hyphens: none; | ||
-moz-hyphens: none; | ||
-ms-hyphens: none; | ||
hyphens: none; | ||
background: #1e1e1e !important; | ||
} | ||
|
||
pre { | ||
padding: 1em; | ||
margin: .5em 0; | ||
overflow: auto | ||
} | ||
|
||
:not(pre) > code { | ||
background: #1e1e1e; | ||
padding: .1em; | ||
border-radius: .3em; | ||
white-space: normal; | ||
} | ||
|
||
@media screen and (max-width:600px) { | ||
table { | ||
width: 100% | ||
} | ||
|
||
table, td, th { | ||
border: none | ||
} | ||
|
||
tr { | ||
border: 1px solid #fff; | ||
display: block | ||
} | ||
|
||
td, th { | ||
display: block | ||
} | ||
|
||
.hidden-lg { | ||
display: block; | ||
font-weight: 700; | ||
text-align: center; | ||
border-bottom: 1px solid #fff | ||
} | ||
|
||
.hidden-sm { | ||
display: none | ||
} | ||
|
||
.spaced-sm { | ||
margin-top: 20px | ||
} | ||
|
||
tbody tr:first-of-type { | ||
border-bottom: none | ||
} | ||
|
||
.button { | ||
background-color: transparent; | ||
border-color: #3c3c3c; | ||
color: #bbb | ||
} | ||
|
||
.button:hover { | ||
border-color: #656565; | ||
background-color: #373737; | ||
opacity: 1 | ||
} | ||
} | ||
</style> | ||
</head> | ||
|
||
|
3 changes: 3 additions & 0 deletions
3
src/DocumentationBrowserViewExtension/Docs/NodeAnnotationNotFound.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## No further documentation provided for this node. | ||
|
||
For more information on how to add extended documentation to your custom nodes, have a look [here](https://github.com/DynamoDS/Dynamo/wiki). | ||
radumg marked this conversation as resolved.
Show resolved
Hide resolved
|
30 changes: 30 additions & 0 deletions
30
src/DocumentationBrowserViewExtension/Docs/syntaxHighlight.html
Large diffs are not rendered by default.
Oops, something went wrong.
88 changes: 88 additions & 0 deletions
88
src/DocumentationBrowserViewExtension/DocumentationBrowserUtils.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Text.RegularExpressions; | ||
using Ganss.XSS; | ||
|
||
namespace Dynamo.DocumentationBrowser | ||
{ | ||
/// <summary> | ||
/// Common utilities used across classes in the DocumentationBrowserViewExtension. | ||
/// </summary> | ||
internal static class DocumentationBrowserUtils | ||
{ | ||
private const string DPISCRIPT = @"<script> | ||
function getDPIScale() | ||
{ | ||
var dpi = 96.0; | ||
if (window.screen.deviceXDPI != undefined) | ||
{ | ||
dpi = window.screen.deviceXDPI; | ||
} | ||
else | ||
{ | ||
var tmpNode = document.createElement('DIV'); | ||
tmpNode.style.cssText = 'width:1in;height:1in;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden'; | ||
document.body.appendChild(tmpNode); | ||
dpi = parseInt(tmpNode.offsetWidth); | ||
tmpNode.parentNode.removeChild(tmpNode); | ||
} | ||
|
||
return dpi / 96.0; | ||
} | ||
|
||
function adaptDPI() | ||
{ | ||
var dpiScale = getDPIScale(); | ||
document.body.style.zoom = dpiScale; | ||
|
||
var widthPercentage = ((100.0 / dpiScale)-5).toString() + '%'; | ||
document.body.style.width = widthPercentage; | ||
} | ||
adaptDPI() | ||
</script>"; | ||
private static HtmlSanitizer htmlSanitizer = new HtmlSanitizer(); | ||
|
||
/// <summary> | ||
/// Clean up possible dangerous HTML content from the content string. | ||
/// </summary> | ||
/// <param name="content"></param> | ||
/// <returns>Returns true if any content was removed from the content string</returns> | ||
internal static bool RemoveScriptTagsFromString(ref string content) | ||
{ | ||
var sanitizedContent = htmlSanitizer.Sanitize(content); | ||
if (content.Equals(sanitizedContent)) | ||
return false; | ||
|
||
content = sanitizedContent; | ||
return true; | ||
} | ||
|
||
/// <summary> | ||
/// Returns the DPIScript | ||
/// </summary> | ||
/// <param name="content"></param> | ||
internal static string GetDPIScript() | ||
{ | ||
return DPISCRIPT; | ||
} | ||
|
||
/// <summary> | ||
/// Returns the content of an embedded resource file. | ||
/// </summary> | ||
/// <param name="resourceName"></param> | ||
/// <returns></returns> | ||
internal static string GetContentFromEmbeddedResource(string resourceName) | ||
{ | ||
var assembly = Assembly.GetExecutingAssembly(); | ||
var result = ""; | ||
|
||
using (Stream stream = assembly.GetManifestResourceStream(resourceName)) | ||
using (StreamReader reader = new StreamReader(stream)) | ||
{ | ||
result = reader.ReadToEnd(); | ||
} | ||
|
||
return result; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this css extracted from prisim.js?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes