fastn
Programming Languagefastn
is designed for everyone, not just programmers.
Getting Started | Watch Course
Star us on Githubfastn
for authoring prosefastn
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.fastn
, but are using open source component libraries, eg fastn-community.github.io/bling/quote. Learn how to build your own.-- import: fastn-community.github.io/bling/quote -- quote.charcoal: Amit Upadhyay label: Creator of `fastn` 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.
fastn
fastn
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: `fastn` is cool!
fastn
is cool!With fastn
, you can express your ideas and bring them to a compilation with ease.
fastn
document:fastn
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.
fastn
can be compared with Markdown, but with fastn
, you can define variables, perform event handling, abstract out logic into custom components etc.fastn
?fastn
can be used using fastn
which provides interface for fastn
. You need to install fastn to get started.
fastn
related links. In fastn
, you can create variables with specific types. fastn
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
fastn
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)
fastn
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.fastn
, 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.fastn
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.
fastn
Hello World!-- import: lib -- lib.h1: Hello World
fastn
document that imports a library named “lib
” and has a level 1 heading of “Hello World”.fastn
language is also a good first class data language. You can define and use records:fastn
-- record person: caption name: string location: optional body bio:
caption
is an alias for string
, and tells fastn
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 `fastn` language. -- end: employees
fastn
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
fastn
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, fastn
language is a first-class data language that provides a better alternative to sharing data through CSV or JSON files. Unlike CSV/JSON, in fastn
, 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.
fastn
language 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 fastn
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.