ftd
Programming Languageftd
is designed for everyone, not just programmers.
Getting Started | Watch Course
Star us on Githubftd
for authoring proseftd
is a DSL for authoring long for text, and have access to rich collection of ready made components.-- amitu: Hello World! 😀 -- ds.markdown: some markdown text! -- amitu: you can also write multiline messages easily! no quotes. and **markdown** is *supported*.
you can also write multiline messages easily!
no quotes. and markdown is supported.-- import: fifthtry.github.io/bling/quote -- quote.charcoal: Amit Upadhyay label: Creator of FTD avatar: $fastn-assets.files.images.amitu.jpg logo: $fastn-assets.files.images.logo-fifthtry.svg The web has lost some of the exuberance from the early 2000s, and it makes me a little sad.
ftd
comes with basic building blocks like text, images and containers using with other UI can be constructed.-- component toggle-text: boolean $current: false caption title: -- ftd.text: $toggle-text.title align-self: center text-align: center color if { toggle-text.current }: #D42D42 color: $inherited.colors.cta-primary.text background.solid: $inherited.colors.cta-primary.base $on-click$: $ftd.toggle($a = $toggle-text.current) border-radius.px: 5 -- end: toggle-text -- toggle-text: `ftd` is cool!
With ftd
, you can express your ideas and bring them to a compilation with ease.
ftd
document:ftd
Hello World!-- ftd.text: Hello World!
The above code would show Hello World
as output.
With just a few lines of code, you can create a visually appealing and impactful document. It is a language that is easy to read and understand. It is not verbose like HTML, and not simplistic like Markdown.
ftd
can be compared with Markdown, but with ftd
, you can define variables, perform event handling, abstract out logic into custom components etc.ftd
?ftd
can be used using fastn
which provides interface for ftd
. You need to install fastn to get started.
fastn
related links. In ftd
, you can create variables with specific types. ftd
is a strongly-typed language, so the type of each variable must be declared.
-- boolean flag: true
In this code, we’re creating a variable named flag
of boolean
type. The variable is defined as immutable, meaning its value cannot be altered. If you want to define a mutable variable, simply add a $
symbol before the variable name.
flag
.-- boolean $flag: true
ftd
makes it easy to add events to your element. Let’s take a look at the following example:ftd.text
kernel component-- boolean $current: true -- ftd.text: Hello World! align-self: center text-align: center padding.px: 20 color if { current }: #D42D42 color: $inherited.colors.cta-primary.text background.solid: $inherited.colors.cta-primary.base $on-click$: $ftd.toggle($a = $current)
ftd
is human beings, it includes many “default functions” that are commonly used, like the toggle
function which can be used to create simple event handling.ftd
, you can create custom components to abstract out logic and improve code organization. For example:-- component toggle-text: boolean $current: false caption title: -- ftd.text: $toggle-text.title align-self: center text-align: center color if { toggle-text.current }: #D42D42 color: $inherited.colors.cta-primary.text background.solid: $inherited.colors.cta-primary.base $on-click$: $ftd.toggle($a = $toggle-text.current) -- end: toggle-text -- toggle-text: `ftd` is cool!
ftd
is cool!toggle-text
, and then instantiated it instead. This way you can create custom component library and use them in our writing without “polluting” the prose with noise.ftd
allows you to separate component and variable definitions into different modules, and then use them in any module by using the import
keyword. This helps to logically organize your code and avoid complexity, leading to cleaner and easier to understand code.
ftd
Hello World!-- import: lib -- lib.h1: Hello World
ftd
document that imports a library named “lib
” and has a level 1 heading of “Hello World”.ftd
is also a good first class data language. You can define and use records:ftd
-- record person: caption name: string location: optional body bio:
caption
is an alias for string
, and tells ftd that the value can come in the “caption” position, after the :
of the “section line”, eg: lines that start with --
. If a field is optional, it must be marked as such.-- person amitu: Amit Upadhyay location: Bangalore, India Amit is the founder and CEO of FifthTry. He loves to code, and is pursuing his childhood goal of becoming a professional starer of the trees.
amitu
. You can also define a list:-- person list employees: -- person: Sourabh Garg location: Ranchi, India -- person: Arpita Jaiswal location: Lucknow, India Arpita is the primary author of `ftd` language. -- end: employees
ftd
provides a way to create a component that can render records and loop through lists to display all members of the list:-- render-person: person: $p $loop$: $employees as $p
ftd
documents can be easily read from say Rust:ftd
files#[derive(serde::Deserialize)] struct Employee { name: String, location: String, bio: Option<String> } let doc = ftd::p2::Document::from("some/id", source, lib)?; let amitu: Employee = doc.get("amitu")?; let employees: Vec<Employee> = doc.get("employees")?;
As mentioned earlier, ftd
is a first-class data language that provides a better alternative to sharing data through CSV or JSON files. Unlike CSV/JSON, in ftd
, data is type-checked, and it offers a proper presentation of the data with the option to define components that can render the data, which can be viewed in a browser.
ftd
can also serve as a language for configuration purposes.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.
Github: https://github.com/FifthTry/ftd
Discord: Join our ftd
channel.
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.