Skip to content

About bdocs wrapper

bdocs is a wrapper script located in the root of the Braze Docs repository that helps you replace links, generate redirect URLs, create deployment descriptions, and more.

Prerequisites

If you haven’t already, complete the steps for Contributing to Braze Docs.

Using bdocs

To run a command, use the following syntax. Replace COMMAND with one of the available commands.

To see the list of commands in your terminal, use the help command:

Copying to your clipboard

If you’re on MacOS, you can copy the output of bdocs directly to your clipboard by using the following command. The | means to “pipe” (or send) the output of the first command to the next command. pbcopy means to write the output to your clipboard instead of the terminal. By combining these commands, you’re sending the output from bdocs to pbcopy using a pipe.

List of commands

deploy

This command creates the pull request description for weekly deployments by comparing which pull requests have been merged into develop but not master and then listing them in the proper Markdown format.

release

This command creates the pull request description for monthly releases by comparing which pull requests have been merged into master since the last release and then listing them in the proper Markdown format.

Reference-style links are not supported within Liquid {% tab %} tags. tlinks (short for “transform links”) transforms all the reference-style links on a file into in-line links—whether it be a normal URL, a {{site.baseurl}}, an image, or other link. This command takes a single file or an entire directory as an argument.

Example command

Example page: Before

Example page: After

rlinks (short for “remove links”) removes any unused reference links from the bottom of a Markdown file. This command takes a single file or an entire directory as an argument.

Example command

Example page: Before

Example page: After

ulinks (short for “update links”) takes a file or directory and updates any old links listed on broken_redirect_list.js with the newest possible link. For example, if link one redirects to link two, and link two redirects to link three, ulinks will replace both link one and link two with link three. This command only updates links starting with {{site.baseurl}}.

Example command

Example page: Before

Example page: After

Ideally, redirects added to assets/js/broken_redirect_list.js should only be used to:

  • Redirect traffic from outside of Braze Docs to the correct content (such as those coming from Stack Overflow, Braze Learning , the Braze Blog, etc.).
  • Prevent existing bookmarks from breaking.

It should not be used to redirect URLs on an existing Braze Docs page to another existing Braze Docs page. Instead, these URLs should be updated with the newest possible link. We want to avoid cases in which someone reading an existing Braze Docs page clicks a link and is redirected from one page, to another page, to another page, and so on. ulinks helps solves this issue, improving the end-user experience.

fblinks (short for “find broken links”) checks each file in the _docs directory for links that lead to a 404 page. Each broken link is written to a .csv file that you can import to Google Sheets.

Requirements

To use fblinks, you’ll need to install the dependencies using yarn. This only needs to be done a single time. To install dependencies, run:

Example command

Example CSV file

lredirects

lredirects (short for “list redirects”) checks if any new redirects have been added to broken_redirect_list.js , then lists all of the old URLs using a base URL of your choice. For more general information, see Redirecting URLs.

The following example uses the Sage AI rebrand PR .

syntax

syntax prints all the unique Braze Docs syntax to the terminal. Keep in mind, this doesn’t include any standard Markdown syntax, only unique syntax. This is helpful for two reasons:

  1. You no longer need to leave your text-editor to verify the syntax of a unique Braze Markdown implementation.
  2. Even if you’re offline, you can easily review the unique Braze Docs syntax—making it easier when working on airplane mode.
$ ./bdocs syntax
This is all of the unique Markdown syntax supported by Braze Docs.

ALERTS
  {% alert TYPE %}
  {% endalert %}

IMAGE LINK
  ![ALT_TEXT.]({% image_buster /assets/img/DIRECTORY/IMAGE.png %})

IMAGE RESIZING
  {: style="max-width:NUMBER%;"}

INCLUDES
  {% multi_lang_include PATH_TO_INCLUDE %}

LIQUID RAW TAGS
  {% raw %}{% endraw %}

TABS
  {% tabs %}
  {% tab NAME %}
  {% endtab %}
  {% endtabs %}

SUBTABS
  {% subtabs %}
  {% subtab NAME %}
  {% endsubtab %}
  {% endsubtabs %}

TABLE WORD-BREAK
  {: .reset-td-br-NUM .reset-td-br-NUM .reset-td-br-NUM .reset-td-br-NUM role="presentation"}
HOW HELPFUL WAS THIS PAGE?
New Stuff!