https://github.com/a-x-/js-in-md
[WIP] Plugins for linting and processing js snippets in markdown files
https://github.com/a-x-/js-in-md
js-in-md mdast remark
Last synced: 3 months ago
JSON representation
[WIP] Plugins for linting and processing js snippets in markdown files
- Host: GitHub
- URL: https://github.com/a-x-/js-in-md
- Owner: a-x-
- License: mit
- Created: 2017-04-01T05:16:03.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-04-01T05:20:10.000Z (about 8 years ago)
- Last Synced: 2025-01-11T01:59:02.471Z (4 months ago)
- Topics: js-in-md, mdast, remark
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# js-in-md
Plugins for linting and processing js snippets in markdown filesWIP
## prototype
```bash
for f in common.blocks/*/*.ru.md; do
remark --tree-out $f 2> /dev/null \
| jq '[.children[] | select(.type? == "code" and .lang? == "js") | .value]' \
| node -p "
'['
+JSON.parse(require('fs').readFileSync('/dev/stdin').toString())
.map(c=>{var c_=c.trim(); c_.startsWith('{') && (c_='('+c_+')'); return 'function(){\\n'+c_+'\\n}'})
.join(',\\n')
+']'" \
| node -c \
|| echo Error in $f;
done
```