ftd.code
ftd.code
is a component used to render the code component in an ftd
document.-- ftd.code: lang: py print("hello world")
print("hello world")
ftd.code
component accepts the below attributes along with the common attributes.text: caption or body
text
-- ftd.code: lang: py text: print("hello world")
print("hello world")
lang: optional string
lang
property defines the language of the code. It is an optional field. In case if the value is not provided, this will take txt
as default value.lang
-- ftd.code: lang: py value = "hello world" print(value)
value = "hello world" print(value)
theme: optional string
The theme
property defines the theme for the code block. It is an optional field with default value base16-ocean.dark
.
The available themes are:
fastn Themes
Note
: Use your desired background color
based on your theme when using any fastn code themes since these fastn themes doesn’t define any background color by itself.fastn-theme.dark
theme-- ftd.code: lang: py theme: fastn-theme.dark background.solid: black value = "hello world" print(value)
value = "hello world" print(value)
fastn-theme.light
theme-- ftd.code: lang: py theme: fastn-theme.light background.solid: white value = "hello world" print(value)
value = "hello world" print(value)
fastn-theme-1.dark
theme-- ftd.code: lang: py theme: fastn-theme-1.dark background.solid: black value = "hello world" print(value)
value = "hello world" print(value)
fastn-theme-1.light
theme-- ftd.code: lang: py theme: fastn-theme-1.light background.solid: white value = "hello world" print(value)
value = "hello world" print(value)
Other Themes
base16-ocean.dark
theme-- ftd.code: lang: py theme: base16-ocean.dark value = "hello world" print(value)
value = "hello world" print(value)
base16-ocean.light
theme-- ftd.code: lang: py theme: base16-ocean.light value = "hello world" print(value)
value = "hello world" print(value)
base16-eighties.dark
theme-- ftd.code: lang: py theme: base16-eighties.dark value = "hello world" print(value)
value = "hello world" print(value)
base16-mocha.dark
theme-- ftd.code: lang: py theme: base16-mocha.dark value = "hello world" print(value)
value = "hello world" print(value)
InspiredGitHub
theme-- ftd.code: lang: py theme: InspiredGitHub value = "hello world" print(value)
value = "hello world" print(value)
Solarized (dark)
theme-- ftd.code: lang: py theme: Solarized (dark) value = "hello world" print(value)
value = "hello world" print(value)
Solarized (light)
theme-- ftd.code: lang: py theme: Solarized (light) value = "hello world" print(value)
value = "hello world" print(value)
text-align: optional ftd.text-align
ftd.code
. It accepts the ftd.text-align
type value and is optional. center
text-align: center
-- ftd.code: lang: py width.fixed.px: 400 text-align: center value = "hello world" print(value)
value = "hello world" print(value)
start
text-align: start
-- ftd.code: lang: py width.fixed.px: 400 text-align: start value = "hello world" print(value)
value = "hello world" print(value)
end
text-align: end
-- ftd.code: lang: py width.fixed.px: 400 text-align: end value = "hello world" print(value)
value = "hello world" print(value)
justify
text-align: justify
-- ftd.code: lang: py width.fixed.px: 400 text-align: justify value = "hello world" print(value)
value = "hello world" print(value)
Have a question or need help?
Visit our GitHub Q&A discussion to get answers and subscribe to it to stay tuned.
Join our Discord channel and share your thoughts, suggestion, question etc.
Connect with our community!We welcome you to join our Discord community today.
We are trying to create the language for human beings and we do not believe it would be possible without your support. We would love to hear from you.