background
Before notes do need to manually word into md format, code snippets, images, etc., before also looked for methods to find a small half-day to give up, a waste of time, till now, could not, once to convert times manually, and it takes a long time, this repetitive work is simply a waste of life. So I decided to stop and to find a way to see an article introduces a key to convert Word to Markdown , there are probably two ways: Writage, Word to Markdown Converter convert online website, as Pandoc I used before, most recently in word format with Pandoc always translate to fail. Writage the windows do not have is very hard to accept, Word to Markdown Converter online conversion page I always fail, so go directly to the github project for help, the results can be run locally, you can also docker and other github Address: https://github.com / benbalter / word-to-markdown
Results: The conversion was successful, but about the same results and Pandoc transformation, the effect is not very good. Although the effect is not very good, but still want to record this process ~
Online conversion
URL: https: //word2md.com/
do not know why I is not, turn not turn qiang, are the result, my classmates and co-workers are some succeed and some can not succeed, I put the mac-related settings are modified He had a change, too.
So try another approach.
Command Usage
Before need to install LibreOffice
gem install word-to-markdown
An error
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory
/ usr / bin protection system integrity protected, and anyone not even be written by the root. You need to run:
sudo GEM install -n / usr / local / bin Sass
➜ ~ sudo gem install -n /usr/local/bin word-to-markdown
又报错了
安装成功了
那么转化一个试一波?
w2m ~/Downloads/ xxx..doc
报错了:
/Library/Ruby/Gems/2.6.0/gems/cliver-0.3.2/lib/cliver/dependency.rb:143:in `raise_not_found!': Could not find an executable ["soffice"] on your path. (Cliver::Dependency::NotFound)
我听说过office,这个soffice是什么?
想起来了
之前让安装这个玩意,之前失败了,就没有在安装了,再去安装下
安装完了之后再转化一次:
w2m ~/Downloads/ xxx.doc
哦豁
我真的很难受
那么进入mac的设置–安全与隐私
那我们就打开好了,哈哈哈
然后回来再次执行这个命令:
w2m ~/Downloads/ xxx.doc
我感动哭了,是转化成功了吗?
赶紧让我们去康康吧
可是这样是显示在终端的
w2m ~/Downloads/ xxx.doc > aaa.md
通弄过这种方式转存到md文件中。
如下图,但是结果貌似不尽人意,这是抓花完成之后的目录
安装服务(web)
https://github.com/benbalter/word-to-markdown-server
Word-to-markdown Server
Build Status
This project contains a lightweight server implementation of word-to-markdown for converting Word Documents as a service.
To run the server, simply run script/server and open localhost:9292 in your browser. The server can also be run on Heroku.
A live version runs at word2md.com.
You can also use it as a service by posting raw HTML to /raw, which will return the raw markdown in response.
Usage
Visit the site, run it locally, or deploy to Heroku.
Docker
NOTE: When running Docker Windows Desktop make sure you are running the application in a Linux Container.
docker build -t w2m .
docker run -p 5000:5000 w2m
open http://localhost:5000
下载完之后执行:
script/server
报错了
bundler: command not found: rerun
Install missing gem executables with `bundle install`
bundle install --binstubs会将软件包中的所有可执行文件安装到项目中的本地bin目录中(请参见http://gembundler.com/),然后可以运行./bin/autotest。
嗯,就听他的
执行
bundle install --binstubs
中间让输入几次密码,我也没有细看,就输入的当前电脑用户的密码
又报错了
An error occurred while installing nokogiri (1.10.2), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.10.2' --source 'https://rubygems.org/'` succeeds before bundling.
我建议您首先使用以下方法卸载Nokogiri:
sudo gem uninstall nokogiri
然后使用rubygems安装Nokogiri:
gem install nokogiri
如果这不起作用,则Nokogiri上存在一个开放问题,无法支持libxml 2.9.0及更高版本。有一个libxml2-2.9.1分支已启动,以准备下一个libxml2版本。
然后尝试从Gemfile中的该分支中拉出,如下所示:
gem “nokogiri”, github: “sparklemotion/nokogiri”, branch: “libxml2-2.9.1”
或安装旧版本的libxml2。
如果仍然不能解决问题,您可能还需要尝试以下建议:如果libxml2混蛋了怎么办。
那么:
sudo gem uninstall nokogiri
gem install nokogiri
报错:
You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.
很明显没有权限
sudo gem install nokogiri
报错:
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.10.7 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/nokogiri-1.10.7/gem_make.out
https://github.com/bundler/bundler/issues/5207
以下说明对我有用。
gem update --system
xcode-select --install
gem install nokogiri
bundle install
愿原力与你同在!!!
中间还安装了一次xcode
但是执行 sudo gem install nokogiri
的时候还是报错了
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory
/ usr / bin protection system integrity protected, and anyone not even be written by the root. You need to run:
sudo GEM install -n / usr / local / bin Sass
https://stackoverflow.com/questions/49213136/you-dont-have-write-permissions-for-the-usr-bin-directory-when- installing-s
then execute:
sudo gem install -n /usr/local/bin nokogiri
Oh excluded, the success of it.
Then come back and then execute
bundle install --binstubs
Or being given a
[DEPRECATED] The --binstubs option will be removed in favor of `bundle binstubs`
Could not locate Gemfile
By way above command execution, and found the results unsatisfactory, these do not continue "to explore."
This article is intended to record about the process.