Skip to content

Instantly share code, notes, and snippets.

@HectorBlisS
Last active May 21, 2020 21:32
Show Gist options
  • Save HectorBlisS/fe23179e5a7de1775dba89645a728ccf to your computer and use it in GitHub Desktop.
Save HectorBlisS/fe23179e5a7de1775dba89645a728ccf to your computer and use it in GitHub Desktop.
let md = new require("markdown-it")()
let result = md.parseInline(
`# markdown-it rulezz!
[mijo](http://link)
> soy una cita
[link2](http://link2.com)
`
, "utf8")
console.log(result)
console.log(result[0].children)
result[0].children.filter(ch=>(ch.tag==="a"&&ch.attrs)).map(c=>console.log(c.attrs[0][1]))
let md = new require("markdown-it")()
let fs = require('fs')
let string = fs.readFileSync('./readme.md', "utf8")
let result = md.parseInline(string)
let links = result[0].children.filter(ch => (ch.tag === "a" && ch.attrs)).map(c => c.attrs[0][1])
console.log(links)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment