Skip to content

Instantly share code, notes, and snippets.

import * as Markdoc from "@markdoc/markdoc";
import {Parser} from "htmlparser2";
const mappings = {
p: 'paragraph',
li: 'item',
table: 'table',
tr: 'tr',
td: 'td',
tbody: 'tbody',
@rpaul-stripe
rpaul-stripe / table-caption.mjs
Created July 25, 2023 13:56
Example that demonstrates how to add a caption to a table in Markdoc
import Markdoc from "@markdoc/markdoc";
const config = {
tags: {
table: {
slots: {
caption: { render: false },
},
transform(node, config) {
if (node.children[0]?.type !== "table") return;
@rpaul-stripe
rpaul-stripe / dl.js
Created July 5, 2022 21:02
Definition lists in Markdoc
const Markdoc = require('@markdoc/markdoc');
const example = `
{% definition-list %}
{% definition term="this is the term" %}
This is the definition
{% /definition %}
{% definition term="another term" %}
@rpaul-stripe
rpaul-stripe / index.html
Created March 24, 2017 15:51
Stripe Checkout Go Example
<html>
<head>
<title>Checkout Example</title>
</head>
<body>
<form action="/charge" method="post" class="payment">
<article>
<label class="amount">
<span>Amount: $5.00</span>
@rpaul-stripe
rpaul-stripe / app.js
Last active July 11, 2020 01:40
Stripe Checkout Node.js Express Example
const keyPublishable = process.env.PUBLISHABLE_KEY;
const keySecret = process.env.SECRET_KEY;
const app = require("express")();
const stripe = require("stripe")(keySecret);
app.set("view engine", "pug");
app.use(require("body-parser").urlencoded({extended: false}));
app.get("/", (req, res) =>