Creating a PDF Book from Markdown with BoxLang

Recently I’ve done some blog posts on BoxLang involving Markdown and PDFs, and I was curious if I could put together something that really demonstrated a complete tool of some sort. With that in mind, I built a "book" system where you can author pages in Markdown and use a BoxLang CLI script to generate a resulting PDF. It’s more a POC than a real app, but it was pretty fun to build. Here’s what I did. Functionality At a high level, the book is created from a source of Markdown files. Each Markdown file can use front matter (data on top) to define variables that are evaluated at the time the book is created. You can also use a "global" data file to define... more →
Posted in: JavaScript

Adding CORS to Your BoxLang APIs

CORS, or Cross-Origin Resource Sharing, has been the bane of my existence at times. Don’t get me wrong, I get the idea behind it. I get why it’s necessary. That being said, I tend to forget about it until I write some client-side JavaScript code that gets hit by it. With that in mind, I thought I’d quickly demonstrate how to build CORS-enabled APIs with BoxLang. It’s incredibly simple, which is good, but you’ll want to keep it in mind when building out your own APIs. What and Why? I’m not going to repeat the full description of CORS available from MDN, but it basically boils down to a security feature in browsers. When executing code on your domain that makes... more →
Posted in: JavaScript

Parsing Markdown in BoxLang – Take 2

A long, long time ago, ok, it was last Thursday, I posted about adding Markdown processing to BoxLang via the Flexmark Java library. After posting it, a few folks were curious why I didn’t use the native import process instead of createObject('java', '...') and the answer was simple – I just didn’t think about it! To give you an idea of the difference, let’s first consider the initial version: function markdownToHTML(str) { // .init() is important! ds = createObject("java", "com.vladsch.flexmark.util.data.MutableDataSet","flexmark-all-0.64.8-lib.jar").init(); ps = createObject("java", "com.vladsch.flexmark.parser.Parser","flexmark-all-0.64.8-lib.jar").builder(ds).build();... more →
Posted in: JavaScript

BoxLang Quick Tips – Working with JSON

Welcome to another BoxLang quick tip – today I’m going to focus on working with JSON in BoxLang. Now, as you can probably guess, JSON is natively supported and supports what you would expect, going to and from JSON, but there’s some particularities of the support that may interest you, so I’ve dug into it. As with my other quick tips, you can skip to the video version at the bottom if you prefer. The Basics Converting data to JSON can be done two ways, either via the built in function (BIF) jsonSerialize or the member function toJSON. There’s no difference here, just use what makes sense for you: name = "Raymond"; age = 52; hobbies = ["beer","books","movies","video... more →
Posted in: JavaScript

Come Learn about BoxLang at Into the Box 2025

Later this month, I’ll be speaking at Into the Box 2025 in Washington, DC and online. I’ve spoken at Into the Box in the past and the Ortus team puts on a great show, so I’d absolutely suggest checking it out if you can. In person tickets are available, although close to selling out. The virtual event gives you everything the in person event does minus the workshops. What will I be speaking about? BoxLang of course! I’ll be giving an introductory session on the language and talking about how you can start using it today. I promise multiple, enterprise-worthy cat demos to go along with it! Come join me and many others! Raymond Camden… more →
Posted in: JavaScript

Scheduling Code in BoxLang

While I was busy getting utterly overwhelmed by deep AI talks at Arc of AI this week, BoxLang released it’s third release candidate, and while there’s multiple goodies in there, the schedular is the one that interests me the most. Currently the only docs are in the release notes, but there’s enough information there to get started. Here’s a quick look at what’s been added. First off – just in case it isn’t obvious, the idea here is to write code that can execute by itself on some predefined schedule. There’s multiple different use cases for this – performing backups, refreshing data from an API, logging stats and so forth. In BoxLang, scheduled... more →
Posted in: JavaScript

BoxLang Quick Tips – Sending Email

Welcome to another BoxLang Quick Tip! As with my other quick tips, I’ll end this blog post with a link to the video version so feel free to skip down to it, or read, or both if you prefer! Today’s quick tip is a look at how BoxLang supports sending email, and as with my previous tips, an additional module is all you need to do. The Mail module can be installed via the CLI like so: install-bx-module bx-mail. Once installed, you get three new components for your runtime: mail – This is the core component and handles all mail operations. You’ll always use this. It has quite a few options so be sure to check the docs, but in general you’ll provide the to, from, subject,... more →
Posted in: JavaScript

BoxLang Quick Tips – PDF Generation

Today’s BoxLang quick tip is one near and dear to my heart, generating PDFs. Creating dynamic, expressive PDFs is fairly easy. Let me show you how. As before, I’ve got a video version as well so you would rather watch that, just skip to the end. Step One – The Module By default, BoxLang doesn’t ship with PDF capabilities built-in, you need to add it via the PDF Module. This can be done quickly via the CLI: install-bx-module bx-pdf Installing the module adds three new tags to your BoxLang runtime: bx:document – This is the core tag for PDF generation. Everything inside it will either be content or directives (see the items below) to control what’s produced. bx:documentitem... more →
Posted in: JavaScript
1 2