{"id":13554741,"url":"https://github.com/akabekobeko/npm-wpxml2md","last_synced_at":"2025-10-26T09:31:00.275Z","repository":{"id":57399643,"uuid":"52270511","full_name":"akabekobeko/npm-wpxml2md","owner":"akabekobeko","description":"Convert the WordPress XML file to Markdown files.","archived":false,"fork":false,"pushed_at":"2018-10-06T04:43:39.000Z","size":758,"stargazers_count":13,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-28T12:03:54.689Z","etag":null,"topics":["markdown","node","npm","wordpress"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akabekobeko.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-22T12:01:00.000Z","updated_at":"2023-08-27T11:24:51.000Z","dependencies_parsed_at":"2022-09-09T18:42:40.736Z","dependency_job_id":null,"html_url":"https://github.com/akabekobeko/npm-wpxml2md","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akabekobeko%2Fnpm-wpxml2md","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akabekobeko%2Fnpm-wpxml2md/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akabekobeko%2Fnpm-wpxml2md/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akabekobeko%2Fnpm-wpxml2md/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akabekobeko","download_url":"https://codeload.github.com/akabekobeko/npm-wpxml2md/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219869487,"owners_count":16555527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["markdown","node","npm","wordpress"],"created_at":"2024-08-01T12:02:54.004Z","updated_at":"2025-10-26T09:30:59.819Z","avatar_url":"https://github.com/akabekobeko.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","npm"],"sub_categories":[],"readme":"# npm-wpxml2md\n\n[![Support Node of LTS](https://img.shields.io/badge/node-LTS-brightgreen.svg)](https://nodejs.org/)\n[![npm version](https://badge.fury.io/js/wpxml2md.svg)](https://badge.fury.io/js/wpxml2md)\n[![Build Status](https://travis-ci.org/akabekobeko/npm-wpxml2md.svg?branch=master)](https://travis-ci.org/akabekobeko/npm-wpxml2md)\n[![Document](https://img.shields.io/badge/document-ESDoc-brightgreen.svg)](https://akabekobeko.github.io/npm-wpxml2md/)\n[![Standard - JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](http://standardjs.com/)\n\nConvert the WordPress XML file to Markdown files.\n\n## Installation\n\n```\n$ npm install wpxml2md\n```\n\n## WordPress XML\n\nCan export the **WordPress XML** in the following way.\n\n1. Displays the management screen of WordPress\n2. Select the `Tools` - `Export` from the menu\n3. Select `All content` in `Choose what to export`\n4. Click to `Download Export File`\n\n## Usage\n\n### Node API\n\n`wpxml2md` is promisify function.\n\n```js\nconst wpxml2md = require('wpxml2md');\n\nconst options = {\n  report: true,\n  noGFM: false,\n  noMELink: true,\n  withMetadata: true,\n  withImageDownload: true,\n  withComment: true,\n  replaceLinkPrefix: {\n    old: 'http://akabeko.me/blog/',\n    new: '/'\n  }\n}\n\nwpxml2md('wordpress.xml', 'dest', options)\n.then(() =\u003e {\n  console.log('Completed!!');\n} )\n.catch((err) =\u003e {\n  console.error(err);\n});\n```\n\n#### wpxml2md\n\n`wpxml2md(src, dest, options)`\n\n|Name|Type|Description|\n|---|---|---|\n|src|String|Path of the XML file exported from WordPress.|\n|dest|String|Destination directory path.|\n|options|Object|Options.|\n\nOptions:\n\n|Name|Type|Description|\n|---|---|---|\n|report|Boolean|Default is `false`. Display the process reports.|\n|noGFM|Boolean|Default is `false`. Disable the Convert the GitHub Flavored Markdown.|\n|noMELink|Boolean|Default is `false`. Disable the Convert the GitHub Extra link on header.|\n|withMetadata|Boolean|Default is `false`. Output article metadata in YAML format at the top of Markdown.|\n|withImageDownload|Boolean|Default is `false`. Download the linked images from articles. The file name is the same as markdown. Multiple images become serial numbers, `DD` is an article posted day (yyyymm\"dd\"). `DD-1.png`, `DD-2.png`, ...etc.|\n|replaceLinkPrefix|Object|Default is `undefined`. Replace the link URL prefix with the specified word.|\n|_replaceLinkPrefix_.old|String|Target.|\n|_replaceLinkPrefix_.new|String|Replacement.|\n\n### CLI\n\n```\nUsage: wpxml2md [OPTIONS]\n\n  Convert the WordPress XML file to Markdown files.\n\n  Options:\n    -h, --help            Display this text.\n    -v, --version         Display the version number.\n    -i, --input           Path of the XML file exported from WordPress.\n    -o, --output          Path of the output directory.\n    -r, --report          Output process reports.\n    --no-gfm              Disable the GitHub Flavored Markdown.\n    --no-melink           Disable the Markdown Extra link on header.\n    --with-metadata       Enable output article metadata.\n    --with-image-download Enable download and replace link syntaxes a linked images from article.\n    --with-comment        Enable comment output from article.\n    --replace-link-prefix Replace the link URL prefix with the specified word, format is \"target=placeholder\".\n                          If \"--replace-link http://example.com/=/\" then \"http://example.com/\" will be replaced with \"/\".\n\n  Examples:\n    $ wpxml2md -i wordpress.xml -o ./dist -r\n    $ wpxml2md -i wordpress.xml -o ./dist -r --with-metadata --with-image-download --with-comment --replace-link-prefix http://akabeko.me/=/\n\n  See also:\n    https://github.com/akabekobeko/npm-wpxml2md\n```\n\n## Conversion\n\nThis section describes the conversion by this tool. Markdown conversion engine was in reference to the design and implementation of the [domchristie/to-markdown](https://github.com/domchristie/to-markdown), rewrite an ES2015 and more.\n\n### Output directories\n\nConverted Markdown files are output in the following directory.\n\n```\nYYYYMMDD-hhmmss/\n├── pages\n│   └── YYYY\n│       └── MM\n│           └── DD.md\n└── posts\n    └── YYYY\n        └── MM\n            └── DD.md\n```\n\n* The name of the root directory is the date time that the execution of the processing\n* The result of converting the **Pages** will be output to the `pages` directory\n* The result of converting the **Posts** will be output to the `posts` directory\n* Markdown's file name is posted date time.\n* If the file or directory name is a duplicate will be added to the **sequential number** at the end.\n\n### HTML TAG\n\nDefault markdown.\n\n|TAG|Markdown|\n|---|---|\n|`Plain Text`|Plain text will keep the line breaks and blank lines. It is a specification to enable the WordPress of paragraph function.|\n|`\u003cp\u003e`|`\\n\\nTEXT\\n\\n`|\n|`\u003cbr\u003e`|`\\n`|\n|`\u003ch1\u003e` |`\\n\\n# TEXT\\n\\n`, support from `h1` to `h6`.|\n|`\u003ch1 id=\"id\"\u003e`|`\\n\\n# TEXT {#id}\\n\\n`, for Markdown Extra.|\n|`\u003chr\u003e`|`\\n\\n* * *\\n\\n`|\n|`\u003cem\u003e`, `\u003ci\u003e`|`_TEXT_`|\n|`\u003cstrong\u003e`, `\u003cb\u003e`|`**TEXT**`|\n|`\u003ccode\u003e`|`` `TEXT` ``|\n|`\u003ca\u003e`|`[TEXT](URL \"ALT\")`|\n|`\u003cimg\u003e`|`![TITLE](URL)`|\n|`\u003cpre\u003e\u003ccode\u003e`|`\\n\\n    TEXT\\n\\n`|\n|`\u003cblockquote\u003e`| `\\n\\n\u003e TEXT\\n\\n`|\n|`\u003cul\u003e\u003cli\u003e`|`\\n\\n* TEXT\\n\\n`|\n|`\u003col\u003e\u003cli\u003e`|`\\n\\n1. TEXT\\n\\n`|\n\nGitHub Flavored Markdown.\n\n|TAG|Markdown|\n|---|---|\n|`\u003cbr\u003e`|`\\n`|\n|`\u003cdel\u003e`, `\u003cs\u003e`, `\u003cstrike\u003e`|`~~TEXT~~`|\n|`\u003cul\u003e\u003cli\u003e\u003cinput type=\"checkbox\"\u003e` |`* [ ] Text`, **checked** is true if `[x]`.|\n|`\u003ctable\u003e` |see: [Organizing information with tables - User Documentation](https://help.github.com/articles/organizing-information-with-tables/)|\n|`\u003cpre\u003e\u003ccode\u003e` |````\\n\\n```\\nCODE\\n```\\n\\n````|\n|`\u003cdiv class=\"highlight highlight-lang\"\u003e\u003cpre\u003e`|````\\n\\n```lang\\nCODE\\n```\\n\\n````|\n\n### Shortcode\n\n#### caption\n\n```\n[caption]\n\u003ca href=\"example.png\" title=\"Title\"\u003e\n  \u003cimg src=\"example.png\" alt=\"Title\"\u003e\u003c/a\u003e\n\u003c/a\u003e\n[/caption]\n```\n\nRemove the short code dregs. Contents will Markdown conversion as HTML.\n\n```\n[![Title](example.png)](example.png \"Title\")\n```\n#### code\n\n```\n[code lang=\"js\"]\nconst test = 'test';\nconsole.log(test);\n[/code]\n```\n\n`code` is converted to a code block.\n\n\n    ```js\n    const test = 'test';\n    console.log(test);\n    ```\n\n\nShort code of programming languages and converts it to a code block.\n\n```\n[js]\nconst test = 'test';\nif (test) {\n  console.log(test);\n}\n[/js]\n```\n\nFor example, the above will be converted to the following.\n\n    ```js\n    const test = 'test';\n    if (test) {\n      console.log(test);\n    }\n    ```\n\nLanguage to be converted is the following. The language names are based on the [SyntaxHighlighter - Bundled Brushes](http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/).\n\n|Language|Shortcode|\n|:--|:--|\n|Plain Text|plain, text|\n|ActionScript3|as3, actionscript3|\n|Bash/shell|bash, shell|\n|ColdFusion|cf, coldfusion|\n|C#|c-sharp, csharp|\n|C++|cpp, c|\n|CSS|css|\n|Delphi|delphi, pas, pascal|\n|Diff|diff, patch|\n|Erlang|erl, erlang|\n|Groovy|groovy|\n|JavaScript|js, jscript, javascript|\n|Java|java|\n|JavaFX|jfx, javafx|\n|Perl|perl, pl|\n|PHP|php|\n|PowerShell|ps, powershell|\n|Python|py, python|\n|Ruby|rails, ror, ruby|\n|Scala|scala|\n|SQL|sql|\n|Visual Basic|vb, vbnet|\n|XML|xml, xhtml, xslt, html, xhtml|\n\n## ChangeLog\n\n* [CHANGELOG](CHANGELOG.md)\n\n## License\n\n* [MIT](LICENSE.txt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakabekobeko%2Fnpm-wpxml2md","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakabekobeko%2Fnpm-wpxml2md","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakabekobeko%2Fnpm-wpxml2md/lists"}