Open Source#
I wrote a rehype plugin for xLog to provide a more convenient way to extend embed, PR #560.
By writing a Transformer
that implements the shouldTransform
and getHTML
methods, you can quickly add embeds.
Here is an example of a CodeSandbox embed:
import type { Transformer } from "../rehype-embed"
import { generateIframeHTML, isHostIncludes } from "./utils"
export const CodeSandboxTransformer: Transformer = {
name: "CodeSandbox",
shouldTransform(url) {
const { host, pathname } = url
return isHostIncludes("codesandbox.io", host) && pathname.includes("/s/")
},
getHTML(url) {
return generateIframeHTML({
name: "codesandbox",
src: url.toString().replace("/s/", "/embed/"),
ratio: "16 / 9",
allow:
"accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking",
sandbox:
"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts",
})
},
}
xLog fixed some bugs:
Added listMaxHeight
prop to react-aplayer, PR #19
Life#
I watched the MSI tournament this week and didn't expect BLG to be so strong, eliminating teams from LCK consecutively and making it to the finals of LPL.
The anniversary event for playing Arknights was too difficult for me, so I chose to copy someone else's work.
After taking a six-month break, I'm ready to start looking for a job.