rdd
Version:
Preview your Markdown locally as it would appear on GitHub, with live updating
17 lines (13 loc) • 402 B
JavaScript
const markyDeepLinks = require('marky-deep-links')
markyDeepLinks()
const webSocket = new window.WebSocket(
`ws://0.0.0.0:${window.__rddWebSocketPort}/`
)
const path = window.location.pathname.substring(1)
webSocket.onopen = function () {
webSocket.send(path)
}
const element = document.querySelector('.markdown-body')
webSocket.onmessage = function (event) {
element.innerHTML = event.data
}