Skip to content

Exporting Files

github-actions[bot] edited this page Sep 23, 2022 · 69 revisions
Clone this wiki locally

Converting Neorg Files to other Filetypes with core.export

Exports Neorg documents into any other supported filetype.

Overview

All export functionality is provided by the :Neorg export command.

To export the currently opened buffer to another file format, you should use the :Neorg export to-file command. The command takes the following arguments:

  • path - the path to export to. Examples are: my-file.md, ~/output.md. If the second argument is not provided Neorg will try to infer the filetype to convert to through the file extension.
  • filetype (optional) - the filetype to export to. Useful if you want to use a non-standard extension, or if the filetype you're using cannot be inferred automatically. Note that this filetype must be a filetype that Neovim itself provides and/or understands, i.e. md or markd is not a valid filetype, however markdown is.

Neorg also supports exporting a directory of files: this is where the :Neorg export directory command comes into play. It takes 3 arguments:

  • directory - the directory to export
  • filetype - the filetype to export to
  • output-dir (optional) - a custom output directory to use. If not provided will fall back to config.public.export_dir (see configuration).

Configuration

export_dir
The directory to export to when running `:Neorg export directory`. The string can be formatted with the special keys: `` and ``.

Default value: "<export-dir>/<language>-export"

Keybinds

This module defines no keybinds.

How to Apply

  • To manually load the module, place this code in your Neorg setup:
    ["core.export"] = {
       config = { -- Note that this table is optional and doesn't need to be provided
           -- Configuration here
       }
    }
    Consult the configuration section to see how you can configure core.export to your liking.

Technical Information

Developer Usage

Public API

This segment will detail all of the functions core.export exposes. All of these functions reside in the public table.

  • get_converter
  • export

Examples

None Provided

Extra Info

Version

This module supports at least version 0.0.14. The current Neorg version is 0.0.14.

Imports

This module does not import any other files.

Requires

Required by

This module isn't required by any other module.