Here is one way using the Date() function in JS. This could then be customised to display exactly what you wanted (date, time, specific date format etc.)
With this method though, if viewing as a HTML slide deck then the datetime will change each time the page is loaded.
If you wanted to insert a static time (e.g. file save date etc), perhaps the easiest way would be to just do a regex replace on a certain phrase eg. {{ date }} as above, before you get Marp to convert the document.
---
marp: true
---
Refresh to see changes...
<p id="date1"></p>
<p id="date2"></p>
<p id="date3"></p>
<script>
const now = new Date()
document.getElementById("date1").innerHTML = now;
document.getElementById("date2").innerHTML = now.toLocaleDateString("en-US");
document.getElementById("date3").innerHTML = now.toLocaleDateString("en-US", {weekday: 'long'});
</script>
Here is one way using the
Date()function in JS. This could then be customised to display exactly what you wanted (date, time, specific date format etc.)With this method though, if viewing as a HTML slide deck then the datetime will change each time the page is loaded.
If you wanted to insert a static time (e.g. file save date etc), perhaps the easiest way would be to just do a regex replace on a certain phrase eg. {{ date }} as above, before you get Marp to convert the document.