File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,9 @@ for (Span span : spans) {
8686sb. toString(); // "wow <a href=\"http://test.com\">http://test.com</a> such linked"
8787```
8888
89+ Note that this assumes that the input is plain text, not HTML.
90+ Also see the "What this is not" section below.
91+
8992Features
9093--------
9194
@@ -161,6 +164,23 @@ matched), unless the `emailDomainMustHaveDot` option is disabled.
161164Use ` LinkType.EMAIL ` for this, and see [ test cases
162165here] ( src/test/java/org/nibor/autolink/AutolinkEmailTest.java ) .
163166
167+ What this is not
168+ ----------------
169+
170+ This library is intentionally * not* aware of HTML. If it was, it would need to depend on an HTML parser and renderer.
171+ Consider this input:
172+
173+ ```
174+ HTML that contains <a href="https://one.example">links</a> but also plain URLs like https://two.example.
175+ ```
176+
177+ If you want to turn the plain links into ` a ` elements but leave the already linked ones intact, I recommend:
178+
179+ 1 . Parse the HTML using an HTML parser library
180+ 2 . Walk through the resulting DOM and use autolink-java to find links within * text* nodes only
181+ 3 . Turn those into ` a ` elements
182+ 4 . Render the DOM back to HTML
183+
164184Contributing
165185------------
166186
You can’t perform that action at this time.
0 commit comments