Home Reference Source Test

Function

Static Public Summary
public

CLI(argv: String[], stdout: WritableStream): Promise

Entry point of the CLI.

public

Comment(src: Object[]): String

Create a comment list.

public

Convert(post: String, modes: Modes): String

Convert the WordPress's post to Markdown. Design and implementation was in reference to the npm to-markdown.

public

Convert the WordPress's shotcode to Markdown.

public

async ImageLinkReplacer(markdown: String, dir: String, basename: String, logger: Logger): Promise

Download the linked image from Markdown and rewrite the link.

public

async WordPressXmlToMarkdown(src: String, dest: String, options: CLIOptions): Promise

Conver WordPress XML file to Markdown files.

Static Public

public CLI(argv: String[], stdout: WritableStream): Promise source

import CLI from 'wpxml2md/src/bin/cli.js'

Entry point of the CLI.

Params:

NameTypeAttributeDescription
argv String[]

Arguments of the command line.

stdout WritableStream

Standard output.

Return:

Promise

Asynchronous task.

Test:

public Comment(src: Object[]): String source

import Comment from 'wpxml2md/src/lib/comment.js'

Create a comment list.

Params:

NameTypeAttributeDescription
src Object[]

Comments (wp:comment).

Return:

String

Comment list (HTML text).

public Convert(post: String, modes: Modes): String source

import Convert from 'wpxml2md/src/lib/converter.js'

Convert the WordPress's post to Markdown. Design and implementation was in reference to the npm to-markdown.

Params:

NameTypeAttributeDescription
post String

WordPress's post text.

modes Modes

Modes.

Return:

String

Markdown text.

Test:

See:

public ConvertShortCode(text: *): String source

import ConvertShortCode from 'wpxml2md/src/lib/shortcode.js'

Convert the WordPress's shotcode to Markdown.

Params:

NameTypeAttributeDescription
text *

Return:

String

Converted string.

Test:

public async ImageLinkReplacer(markdown: String, dir: String, basename: String, logger: Logger): Promise source

import ImageLinkReplacer from 'wpxml2md/src/lib/image-link-replacer.js'

Download the linked image from Markdown and rewrite the link.

Params:

NameTypeAttributeDescription
markdown String

Markdown text.

dir String

Directory where Markdown was output.

basename String

Name to be the base of the image file to be saved.

logger Logger

Logger.

Return:

Promise

Asynchronous task.

Test:

public async WordPressXmlToMarkdown(src: String, dest: String, options: CLIOptions): Promise source

import WordPressXmlToMarkdown from 'wpxml2md/src/lib/wpxml2md.js'

Conver WordPress XML file to Markdown files.

Params:

NameTypeAttributeDescription
src String

Path of the WordPress XML file.

dest String

Path of Markdown files output directory.

options CLIOptions

Options.

Return:

Promise

Promise object.

Test: