Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/frontend/editors/slate/markdown-to-slate/util.ts
1697 views
1
import { load } from "cheerio";
2
3
export function getAttrs(content: string, attrs: string[]): [string, string][] {
4
const $ = load("");
5
const x = $(content);
6
const v: [string, string][] = [];
7
for (const attr of attrs) {
8
const val = x.attr(attr);
9
if (val != null) {
10
v.push([attr, val]);
11
}
12
}
13
return v;
14
}
15
16