This may be a very niche query, but I’ll ask it anyway. I’m looking for some way of including mathematical diagrams in my posts. Mathjax doesn’t handle diagrams, so I’d need to use a javascript library, something like mathbox, JSXGraph or vis.js. I’m wondering which of these people can recommend, and which is most likely to “play nice” with Hugo? (Or are all javascript libraries the same, from a Hugo perspective?)
I can always create diagrams locally and include them as screenshots, but that’s clumsy, and never looks as nice as a crisp diagram created on the page, so to speak.
I’m using http://www.chartjs.org/ but they need the javascript to be “ready” with data and all.
So I’m finishing to write shortcodes to automate CSV files process, so Hugo does all the job for creating the javascript.
As RickGogley said, hugo is just a code generator in that case.
I’ll publish it on discourse when it is ready to be shown (my repository is not a public one)
Thanks for that - from a brief hunt about I think that JSXGraph is probably my best bet… I’ll see how I go incorporating it into Hugo. As far as I can tell it’s just a matter of dropping a js and a css file in the right places. (And then using it…) When (and if…) I get round to it I’ll yet you know!
Well, I’ve finally got around to trying JSXGraph. I’ve included the script for in the layouts/partials/head.html file of the theme I’m using (Blackburn), right underneath the script that calls mathjax. In my post I’ve tried the code block listed at https://jsxgraph.uni-bayreuth.de/wiki/index.php/Howto_include_JSXGraph_into_web_pages. But all I get is a square in my post which is empty - no JSXGraph material is seen.
I wonder if you would be able to let me know how you included ChartJS in your own blog? Thanks!
Many thanks indeed for your code. I don’t fully understand the reason for everything at the moment, but I’ll keep exploring, with your example as a guide. Thank you again!
Thank you; I’ve checked all of those to find nothing I can easily see as an error. It looks as though it’s running fine, except that it’s not! I suspect that it’s the way I’ve called the library in my post, simply with:
I’ve found a possible source of error. In the conversion to HTML, the identifirer 'box' in the third line of my previous post is turned into
‘box’
which causes the browser to choke on it. At least, when I opened up the browser console, this was an error given. So I need to ensure that this translation of single quote marks into HTML code doesn’t happen… I’ll get back to you.