Skip to content

Commit

Permalink
feat(developer): add button to show parsed structure (#2345)
Browse files Browse the repository at this point in the history
  • Loading branch information
nknapp authored and joshgoebel committed Jan 15, 2020
1 parent 42f1df4 commit b33ef93
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CHANGES.md
Expand Up @@ -20,11 +20,15 @@ Language Improvements:
- (vbnet) add nameof operator to the keywords (#2329) [Youssef Victor][]
- (stan) updated with improved coverage of language keywords and patterns. (#1829) [Jeffrey Arnold][]

Developer Tools:

- feat(developer): add button to show parsed structure (#2345) [Nils Knappmeier][]

[Jeffrey Arnold]: https://github.com/jrnold
[Josh Goebel]: https://github.com/yyyc514
[Philipp Engel]: https://github.com/interkosmos
[Youssef Victor]: https://github.com/Youssef1313

[Nils Knappmeier]: https://github.com/nknapp

## Version 9.17.1

Expand Down
28 changes: 26 additions & 2 deletions tools/developer.html
Expand Up @@ -26,6 +26,24 @@
.hljs-debug {
color: red; font-weight: bold;
}

.visible-structure pre code span {
display: block;
padding: 0.5em;
margin: 0.5em;
border: 1px dashed black;
position: relative;
white-space: pre;
}

.visible-structure pre code span:before {
display: block;
content: attr(class);
color: black;
font-size: 70%;
float:right;
margin-top: -0.5em;
}
</style>
</head>
<body>
Expand All @@ -35,7 +53,8 @@ <h1>highlight.js developer</h1>
<div>
<textarea>Put code here…</textarea>
<p>
<button>Update highlighting</button>
<button id="update-highlighting">Update highlighting</button>
<button id="show-structure">Show/hide structure</button>
Language: <select class="languages"><option value="">(Auto)</option></select>
</p>
</div>
Expand All @@ -61,7 +80,7 @@ <h1>highlight.js developer</h1>
select.append('<option>' + l + '</option>');
});

$('.editor button').click(function(e) {
$('.editor button#update-highlighting').click(function(e) {
var editor = $(this).parents('.editor');
var language = editor.find('.languages').val();
var source = editor.find('textarea').val();
Expand All @@ -78,6 +97,11 @@ <h1>highlight.js developer</h1>
editor.find('output').text(result.value);
SourceStore.save(source, language);
});

$('.editor button#show-structure').click(function(e) {
var editor = $(this).parents('.editor');
editor.toggleClass('visible-structure');
});
});

var SourceStore;
Expand Down

0 comments on commit b33ef93

Please sign in to comment.