项目作者: a-x-

项目描述 :
[WIP] Plugins for linting and processing js snippets in markdown files
高级语言:
项目地址: git://github.com/a-x-/js-in-md.git
创建时间: 2017-04-01T05:16:03Z
项目社区:https://github.com/a-x-/js-in-md

开源协议:MIT License

下载


js-in-md

Plugins for linting and processing js snippets in markdown files

WIP

prototype

  1. for f in common.blocks/*/*.ru.md; do
  2. remark --tree-out $f 2> /dev/null \
  3. | jq '[.children[] | select(.type? == "code" and .lang? == "js") | .value]' \
  4. | node -p "
  5. '['
  6. +JSON.parse(require('fs').readFileSync('/dev/stdin').toString())
  7. .map(c=>{var c_=c.trim(); c_.startsWith('{') && (c_='('+c_+')'); return 'function(){\\n'+c_+'\\n}'})
  8. .join(',\\n')
  9. +']'" \
  10. | node -c \
  11. || echo Error in $f;
  12. done