twardoch / mkdocs-combine

Convert an MkDocs Markdown source site to a single Markdown document
https://twardoch.github.io/mkdocs-combine/
Apache License 2.0
38 stars 17 forks source link

Make regex in xref.py more robust #17

Closed Ir1d closed 5 years ago

Ir1d commented 6 years ago

In mkdocs-material, the links don't have to end with .md, for example: [asdf](/xx/yy) works fine.

I've tried [^!]\[([^\]]+?)\]\(([^http].*?)\),

but in here it touches the code blocks. (LGTM now)

I've generated a few test cases:

[asdfasdf](asdasdf)
[asdfasdf](asdasdf.md)
[asdfasdf](/asdasdf)
[asdfasdf](./asdasdf)
![asdfasdf](./images/asdasdf.jpg)
[asdfasdf](http://example.com)
[asdfasdf](https://example.com)
[asdfasdf](file:///example.com)
[Testlib](#testlib)

[asdfasdf](/asdasdf) asdfasfasdfasdfd [asdfasdf](/asdasdf) asdfasdfasdf[asdfasdf](/asdasdf)

int operator[](const int a) { return to[a]; }

![Word Art](/home/asdfasdf/images/wordArt.png)

regex101: https://regex101.com/r/jw7aY4/3