Ramundo,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<div id="d1">[h:значение y] [i:значение x] [h:abaddon] fgdfgdfg [h:slark] fgfdgdfgdfgdf [i:shadowblade], dvdfgdfg [i:tango].</div>
<script>
function LinkCode(match, folder, name){
var obj = {i : "items", h : "heroes"};
folder = obj[folder] || folder;
var url = "/"+ folder +"/view/" + encodeURI(name);
return '<a href = "'+url+'">' + name +'</a>';
}
document.querySelector("#d1").innerHTML = document.querySelector("#d1").innerHTML.replace(/\[(\S):([^\]]+)\]/ig, LinkCode);
</script>
</body>
</html>