Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F996606
heading.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
780 B
Referenced Files
None
Subscribers
None
heading.ts
View Options
import
{
predicates
,
ShapeToType
}
from
"@sealcode/ts-predicates"
;
import
{
Primitive
}
from
"./primitive"
;
export
const
HeadingShape
=
{
type
:
predicates
.
const
(
<
const
>
"heading"
),
content
:
predicates
.
string
,
level
:
predicates
.
number
,
id
:
predicates
.
maybe
(
predicates
.
string
),
};
export
type
HeadingJSON
=
ShapeToType
<
typeof
HeadingShape
>
;
export
class
HeadingPrimitive
extends
Primitive
{
content
:
string
;
level
:
number
;
id
:
string
|
null
=
null
;
constructor
(
json
:
Record
<
string
,
unknown
>
)
{
super
();
this
.
content
=
json
[
"content"
]
as
string
;
this
.
level
=
json
[
"level"
]
as
number
;
this
.
id
=
json
[
"id"
]
as
string
|
null
;
}
to_html
()
:
string
{
return
/* HTML */
`<h1>
${
this
.
content
}
</h1>`
;
}
extract_headings
()
:
HeadingPrimitive
[]
{
return
[
this
];
}
}
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Tue, Dec 24, 14:05 (14 m, 12 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
557337
Default Alt Text
heading.ts (780 B)
Attached To
Mode
R130 jdd
Attached
Detach File
Event Timeline
Log In to Comment