-
Notifications
You must be signed in to change notification settings - Fork 438
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
Add wavedrom support. #655
Changes from 6 commits
476811b
0a650f7
ab0256d
d667b23
8b15abc
f5a3130
0112dd5
be68539
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -172,3 +172,13 @@ creative_commons: | |
version: 2020.11.3 | ||
dir: assets/license_badges | ||
alias: creativecommons-vocabulary | ||
wavedrom: | ||
name: 'wavedrom' | ||
version: 3.2.0 | ||
file: wavedrom.min.js | ||
integrity: sha512-/ZL0uQxVV1wYyWlpO4klZ1a39eaBz4zESSamuBMaMsZ6le3YejJ07hmLlHoCTXrKz5eYtEuO5K1BcTo+lQpQJA== | ||
wavedrom_skin: | ||
name: 'wavedrom' | ||
version: 3.2.0 | ||
file: skins/default.min.js | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. got it. moved to default.js now. |
||
integrity: sha512-SDH/iWIRSg0ujndO7Np7wyJF/zs8JHp4tHKU4VJuraJ3ASd2sVorT/3uA2xnHthywvei4/fJYz8Lsbr1SChYBQ== | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{%- if theme.wavedrom.enable %} | ||
{{ next_data('wavedrom', theme.wavedrom, { | ||
js: theme.vendors.wavedrom | ||
}) }} | ||
{{ next_data('wavedrom_skin', theme.wavedrom, { | ||
js: theme.vendors.wavedrom_skin | ||
}) }} | ||
{{ next_js('third-party/tags/wavedrom.js') }} | ||
{%- endif %} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* wavedrom.js | https://theme-next.js.org/docs/tag-plugins/wavedrom | ||
*/ | ||
|
||
'use strict'; | ||
|
||
module.exports = function(args, content) { | ||
return `<div class="wavedrom"><script type="WaveDrom"> | ||
${content} | ||
</script></div>`; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
if (hexo-config('wavedrom.enable')) { | ||
.wavedrom { | ||
margin-bottom: 20px; | ||
text-align: center; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/* global NexT, CONFIG, WaveDrom */ | ||
|
||
document.addEventListener('page:loaded', () => { | ||
NexT.utils.getScript(CONFIG.wavedrom.js, { | ||
condition: window.WaveDrom | ||
}).then(() => { | ||
NexT.utils.getScript(CONFIG.wavedrom_skin.js).then(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Condition for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Got it. Didn't add it since it is in the then block. It is fixed now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. demo page is also updated now: https://r12f.com/posts/use-wavedrom-in-hexo/ |
||
WaveDrom.ProcessAll(); | ||
}); | ||
}); | ||
}); |
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.
You can remove single quotes in this line
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.
got it. removed.