mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
Merge pull request #33618 from htkzhtm/TextRenderer
[marked] Add TextRenderer types
This commit is contained in:
Vendored
+12
@@ -4,6 +4,7 @@
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// CrossR <https://github.com/CrossR>
|
||||
// Mike Wickett <https://github.com/mwickett>
|
||||
// Hitomi Hatsukaze <https://github.com/htkzhtm>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export as namespace marked;
|
||||
@@ -102,6 +103,17 @@ declare namespace marked {
|
||||
text(text: string): string;
|
||||
}
|
||||
|
||||
class TextRenderer {
|
||||
strong(text: string): string;
|
||||
em(text: string): string;
|
||||
codespan(text: string): string;
|
||||
del(text: string): string;
|
||||
text(text: string): string;
|
||||
link(href: string, title: string, text: string): string;
|
||||
image(href: string, title: string, text: string): string;
|
||||
br(): string;
|
||||
}
|
||||
|
||||
class Lexer {
|
||||
rules: Rules;
|
||||
tokens: TokensList;
|
||||
|
||||
@@ -48,3 +48,6 @@ const slugger = new marked.Slugger();
|
||||
renderer.heading = (text, level, raw, slugger) => {
|
||||
return text + level.toString() + slugger.slug(raw);
|
||||
};
|
||||
|
||||
const textRenderer = new marked.TextRenderer();
|
||||
console.log(textRenderer.strong(text));
|
||||
|
||||
Reference in New Issue
Block a user