Page MenuHomeSealhub

markdown.ts
No OneTemporary

markdown.ts

import { is, predicates } from "@sealcode/ts-predicates";
import { JDDContext } from "../jdd-context.js";
import { MaybePromise } from "../utils/util-types.js";
import { StringBasedArgument } from "./string-based-argument.js";
export class MarkdownArgument extends StringBasedArgument<string> {
getTypeName() {
return "markdown";
}
getEmptyValue() {
return "";
}
countWords(value: string): number {
return value.toString().split(" ").length;
}
example_values = [
`*Lorem ipsum* dolor sit amet, **consectetur adipiscing elit**, sed [do eiusmod](#) tempor incididunt ut labore et dolore magna aliqua. Posuere lorem ipsum dolor sit amet consectetur adipiscing elit. Porttitor massa id neque aliquam vestibulum. Turpis egestas pretium aenean pharetra.
Ullamcorper dignissim cras tincidunt lobortis feugiat vivamus at augue. Tellus cras adipiscing enim eu turpis egestas. Sagittis id consectetur purus ut faucibus pulvinar elementum. Pulvinar etiam non quam lacus suspendisse. Viverra adipiscing at in tellus integer feugiat scelerisque. Ultricies leo integer malesuada nunc vel risus commodo. Morbi leo urna molestie at elementum. Justo laoreet sit amet cursus sit amet. `,
`**Duis ut diam quam nulla**.
Lectus mauris *ultrices* eros [in cursus turpis massa](#).
Pulvinar neque laoreet suspendisse interdum consectetur. Orci phasellus egestas tellus rutrum tellus.`,
];
parseFormInput(
_: JDDContext,
input: unknown
): MaybePromise<string | string[] | null> {
if (is(input, predicates.string)) {
return input;
} else {
return null;
}
}
}

File Metadata

Mime Type
text/x-Algol68
Expires
Tue, Dec 24, 14:03 (17 h, 16 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557263
Default Alt Text
markdown.ts (1 KB)

Event Timeline