• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

mdn/markdown: MDN Web Docs tool to covert HTML to Markdown

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

mdn/markdown

开源软件地址(OpenSource Url):

https://github.com/mdn/markdown

开源编程语言(OpenSource Language):

JavaScript 90.2%

开源软件介绍(OpenSource Introduction):

markdown

MDN Web Docs tool to covert HTML to Markdown.

Prerequisites

Setup

  1. Install dependencies with
yarn
  1. Write a .env file in the repository directory which indicates where are the files of your local mdn/content and/or mdn/translated-content copies. You will need the variables CONTENT_ROOT and CONTENT_TRANSLATED_ROOT. As an example, the content of this file could look like:
CONTENT_TRANSLATED_ROOT=../translated-content/files
CONTENT_ROOT=../content/files

How to use

To run the script, run yarn h2m <folder> --locale <locale> --mode <mode>, where <folder> is the target folder to convert (leave blank for all folders), <locale> is the target locale (default: all), and <mode> is the desired operating mode. This will analyze the HTML files within the specified folder and convert them to Markdown. A report file (md-conversion-problems-report-1660812645.md) will be generated in the root of this repository if there were any elements that could not be converted.

We recommend reading the conversion guide for a full tutorial on Markdown conversion.

Modes

  • dry: Run the conversion script without producing any changes
  • keep: Create the Markdown files but do not remove the original HTML files
  • replace: Remove the HTML files and replace them with the Markdown files

Examples

To perform a test run of the conversion for the web/http folder of the English locale:

yarn h2m web/http --locale en-US --mode dry

To perform a conversion of all French locale files:

yarn h2m --locale fr --mode replace

Or perform a conversion of specifically the mdn Spanish doc without converting the rest of the folder, keeping the original HTML file:

yarn mdn/index.html --locale es --mode keep

--skip-problems

To speed up conversion, you can specify a --skip-problems argument to skip conversion of any files containing conversion issues:

yarn h2m conflicting/web --locale de --mode replace --skip-problems



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap