Skip to content
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

updated tools/developer.html #3776

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
## Version 11.9.0
## Version 11.9.0 (next release)

Parser:

- (enh) prevent rehighlighting of an element [joshgoebel][]
- added 3rd party Iptables grammar to SUPPORTED_LANGUAGES [Checconio][]

Dev tool:

- (chore) Update dev tool to use the new `highlight` API. [Shah Shabbir Ahmmed][]
- (enh) Auto-update the highlighted output when the language dropdown changes. [Shah Shabbir Ahmmed][]

[Shah Shabbir Ahmmed]: https://github.com/shabbir23ah
[Josh Goebel]: https://github.com/joshgoebel
[Checconio]: https://github.com/Checconio

Expand Down
10 changes: 7 additions & 3 deletions tools/developer.html
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,12 @@ <h3>Markup</h3>
localStorage.setItem(key_THEME, css);
})

$('.editor button#update-highlighting').click(function(e) {
function update() {
var editor = $(this).parents('.editor');
var language = editor.find('.languages').val();
var source = editor.find('textarea').val();
var start_time = +new Date();
var result = hljs.getLanguage(language) ? hljs.highlight(language, source, true) : hljs.highlightAuto(source);
var result = hljs.getLanguage(language) ? hljs.highlight(source, { language, ignoreIllegals: true}) : hljs.highlightAuto(source);
var rendering_time = +new Date() - start_time;
editor.find('.hljs').html(result.value);
$(".hljs span").each((_,el) => {
Expand All @@ -383,7 +383,11 @@ <h3>Markup</h3>
editor.find('.rendering_time').text(rendering_time);
editor.find('output').text(result.value);
saveSettings();
});

};

$('.editor button#update-highlighting').click(update);
$(".languages").change(update);

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