marked using linkify-it for urls
import { marked } from "marked";
import markedLinkifyIt from "marked-linkify-it";
// or UMD script
// <script src="https://cdn.jsdelivr.net/npm/marked/lib/marked.umd.js"></script>
// <script src="https://cdn.jsdelivr.net/npm/marked-linkify-it/lib/index.umd.js"></script>
const schemas = {};
const options = {};
marked.use(markedLinkifyIt(schemas, options));
marked("example.com");
// <p><a href="http://example.com">example.com</a></p>Note: #add() doesn't work with this extension
markedLinkifyIt.add('@', {...}) // Doesn't work, you need to pass a schema manuallyInstead do:
const schemas = {
'@': {
validate: function (text, pos, self) {
// ...
},
normalize: function (match) {
// ...
}
}
};linkify options plus the following additional options:
String|String[]
replace or add tlds for fuzzy links/
Boolean; Default: false
true to add domains instead of replacing domain list.