Update to support wrap syntax for code block
This commit is contained in:
parent
f93e8f5fdc
commit
211d25253e
4 changed files with 20 additions and 3 deletions
|
@ -121,3 +121,11 @@
|
|||
max-width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.markdown-body pre > code.wrap {
|
||||
white-space: pre-wrap; /* Since CSS 2.1 */
|
||||
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
|
||||
white-space: -pre-wrap; /* Opera 4-6 */
|
||||
white-space: -o-pre-wrap; /* Opera 7 */
|
||||
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
||||
}
|
|
@ -171,6 +171,12 @@ var s = "JavaScript syntax highlighting";
|
|||
alert(s);
|
||||
```
|
||||
|
||||
> Somtimes you have a super long text without breaks. It's time to use `!` to wrap your code.
|
||||
|
||||
```!
|
||||
When you’re a carpenter making a beautiful chest of drawers, you’re not going to use a piece of plywood on the back.
|
||||
```
|
||||
|
||||
### Blockquote Tags:
|
||||
> Using the syntax below to specifiy your **name, time and color** to vary the blockquotes.
|
||||
> [name=ChengHan Wu] [time=Sun, Jun 28, 2015 9:59 PM] [color=#907bf7]
|
||||
|
|
|
@ -448,7 +448,8 @@ function finishView(view) {
|
|||
.each(function (key, value) {
|
||||
var langDiv = $(value).find('code.hljs');
|
||||
if (langDiv.length > 0) {
|
||||
var reallang = langDiv[0].className.replace('hljs', '').trim();
|
||||
var reallang = langDiv[0].className.replace(/hljs|wrap/g, '').trim();
|
||||
if (!reallang) return;
|
||||
var codeDiv = $(value).find('.code');
|
||||
var code = "";
|
||||
if (codeDiv.length > 0) code = codeDiv.html();
|
||||
|
@ -897,7 +898,8 @@ md.renderer.rules.fence = function (tokens, idx, options, env, self) {
|
|||
|
||||
if (info) {
|
||||
langName = info.split(/\s+/g)[0];
|
||||
token.attrJoin('class', options.langPrefix + langName.replace(/\=$|\=\d+$|\=\+$/, ''));
|
||||
if (/\!$/.test(info)) token.attrJoin('class', 'wrap');
|
||||
token.attrJoin('class', options.langPrefix + langName.replace(/\=$|\=\d+$|\=\+$|\!$|\=\!$/, ''));
|
||||
token.attrJoin('class', 'hljs');
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,8 @@ md.renderer.rules.fence = function (tokens, idx, options, env, self) {
|
|||
|
||||
if (info) {
|
||||
langName = info.split(/\s+/g)[0];
|
||||
token.attrJoin('class', options.langPrefix + langName.replace(/\=$|\=\d+$|\=\+$/, ''));
|
||||
if (/\!$/.test(info)) token.attrJoin('class', 'wrap');
|
||||
token.attrJoin('class', options.langPrefix + langName.replace(/\=$|\=\d+$|\=\+$|\!$|\=\!/, ''));
|
||||
token.attrJoin('class', 'hljs');
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue