-- code
can be used as code-block inside your fastn web projects.Code blocks are typically defined by using specific syntax or indentation rules, depending on the programming language.
Note: The code
component is already included within the doc-site.
Therefore, if you are utilizing doc-site
,
there is no need to include the code-block as a fastn dependency.
lang
property you can define which language code snippet you want to
show your users.-- cb.code:
lang: java
if (condition) {
// code block
statement1;
statement2;
// ...
}
if (condition) {
// code block
statement1;
statement2;
// ...
}
code-block
dependency into your FASTN.ftd-- fastn.dependency: fastn-community.github.io/code-block
code-block
into your .ftd
document-- import: fastn-community.github.io/code-block as cb
-- cb.code:
lang: ftd
download: sample.ftd
-- ftd.text: Hello World
role: $inherited.types.copy-regular
color: $inherited.colors.text
caption
optional
)lang
required
)download
optional
)body
required
)copy
default: true
)true
to false
.max-height
optional
)max-height
property inside code-block if you want to restrict
max-height
of the code-block. This property type is ftd.resizing
which
means your can define it as below:
max-height.fixed.px: 200
it will restrict max-height to 200 pixels, you can
use other CSS units e.g. em, rem etc.max-height.fixed.percent: 30
it will restrict max-height to 30%.max-height: fill-container
max-height will be 100 %.max-width
optional
)max-width
property inside code-block if you want to restrict
max-width
of the code-block. This property type is ftd.resizing
which means
your can define it as below:
max-width.fixed.px: 200
it will restrict max-width to 200 pixels, you can
use other CSS units e.g. em, rem etc.max-width.fixed.percent: 30
it will restrict max-width to 30%.max-width: fill-container
max-width will be 100%.