|
|Link from links list at end|`[hobbit-hole][1]` ==> [hobbit-hole][1]|
|Local relative link 1|`` ==> |
|Local relative link 2|`[this page](/index.html)` ==> [this page](/index.html)|
|Local relative link 3|`[this page][self]` ==> [this page][self]|
|Mentioning people and the like 1|`@github/support` ==> @github/support (no link)|
|Mentioning people and the like 2|`@github/ETCDema` ==> @github/ETCDema (with link from ext)|
|Images|`` => |
|Image in float box|`!` ==>!<== floating box from here, _this text after floating box_|
|Symbols 1|`...` ==> ...|
|Symbols 2|`(c)` ==> (c)|
|Symbols 3|`(TM)` ==> (TM)|
|Symbols 4|`(R)` ==> (R)|
|Symbols and arrows|`<-- <--> --> <== <==> ==>` <-- <--> --> <== <==> ==>|
---
### Preformatted, code blocks and embeded objects
Preformatted:
```
git status
git add
git commit
```
JS code block:
``` js
function hello()
{
alert('Hello!');
}
// GO!
hello();
```
#### Embedded element, rendered by extension:
JSON data for extension `progress-bar` (code block started with ``````` progress-bar`):
``` json
{ "max" : 200, "value": 98, "label": "Embedded progress:" }
```
Result:
``` progress-bar
{ "max" : 200, "value": 98, "label": "Embedded progress:" }
```
### Ruler
* * *
That's All!
* * *
[self]: /index.html "This page title"
[1]: https://en.wikipedia.org/wiki/Hobbit#Lifestyle "Hobbit lifestyles"
## Render extension source
``` js
// Заголовки для блоков предупреждений
const _alertLabels = {
note : '',
important : '',
warning : '',
};
// Отображение встроенного объекта
function _progressBar(json)
{
try
{
const data = JSON.parse(json);
return ''
} catch(e)
{
return 'Progress bar FAIL: '+e.message;
}
}
// Расширения генерации HTML
const renderExt = {
// Заголовки блоков предупреждений
alertLabel : (alert) => _alertLabels[alert],
// Значение атрибута target для ссылок
linkTarget : (url) => url.url[0]!=='/' && '_blank',
// Упоминания
mention : (el, buf) =>
{
if (el.group!=='github' || el.id!=='ETCDema') return false;
buf.html('@GitHub/ETCDema');
},
// Подсветка кода
code : (lang, code) =>
{
if (lang==='progress-bar') return _progressBar(code);
const fx = dmSyntax[lang.toUpperCase()];
return fx && (''+fx(code)+'
');
},
};
```