![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
adf-builder
Advanced tools
A library that simplifies building documents that follow the Atlassian Document Format structure.
Install the package using
npm i -S adf-builder
or
yarn add adf-builder
This package offers two ways of building documents:
import { Document } from 'adf-builder'; // For TypeScript or ES6
// const { Document } = require('adf-builder'); // For node/commonjs
const doc = new Document();
doc.paragraph()
.text('See the ')
.link('documention', 'https://example.com')
.text(' ')
.emoji(':smile:');
import { document, emoji, link } from 'adf-builder'; // For TypeScript or ES6
// const { document, emoji, link } = require('adf-builder'); // For node/commonjs
const doc = document`See the ${link('documentation', 'https://example.com')} ${emoji(':smile:')}`;
A document can be serialized in different ways:
const doc = new Document();
doc.toJSON(); // Returns the Atlassian Document Format structure
doc.toString(); // Returns a compact JSON string
JSON.stringify(doc); // Equivalent to 'doc.toString()', but can be used for pretty printing
If you use the library with TypeScript or with an IDE that interprets the index.d.ts
file declared
in package.json
for JavaScript projects, you will get automatic code completion.
In order to get an output like:
Hello @joe, please carefully read this contract
You would use:
const { Document } = require('adf-builder');
const doc = new Document();
doc.paragraph()
.text('Hello ')
.mention(id, 'joe')
.text(', please ')
.em('carefully')
.text(' read ')
.link('this contract', 'https://www.example.com/contract');
The Paragraph
class has some convenience methods for text with a single mark like strong
, link
, etc.
If you need more than one mark, you can use the marks builder:
const { Document, marks } = require('adf-builder');
const doc = new Document();
doc.paragraph()
.text('Formatted', marks().color('#f0f0f0').strong());
doc.applicationCard('Title')
.background('https://example.com/bg.png')
.link('https://example.com/something')
.description('Some description')
.detail()
.title('Status')
.text('Open')
.icon({url: 'https://example.com/open.png', title: 'Not resolved yet'});
For lists, there are some convenience methods that cover the simple cases. Consider a list like the following:
In order to create that list, you can use:
doc.bulletList()
.textItem('Do this first')
.textItem('Do this second');
Similarly for lists of links:
doc.orderedList()
.linkItem('Do this first', 'https://example.com/1')
.linkItem('Do this second', 'https://example.com/1');
For more complex use cases, use:
const list = doc.bulletList();
list.item().paragraph().text('a'); // add more to the paragraph
list.item().paragraph().text('b'); // add more to the paragraph
FAQs
Atlassian Document Format Builder
The npm package adf-builder receives a total of 6,111 weekly downloads. As such, adf-builder popularity was classified as popular.
We found that adf-builder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.