-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6dea685
commit 3444884
Showing
12 changed files
with
163 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.git/ | ||
packages/docsify-server-renderer/build.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
import { inBrowser } from '../util/env' | ||
|
||
function replace (m, $1) { | ||
return '<img class="emoji" src="https://assets-cdn.github.com/images/icons/emoji/' + $1 + '.png" alt="' + $1 + '" />' | ||
} | ||
|
||
export function emojify (text) { | ||
return $docsify.noEmoji ? text : text | ||
return text | ||
.replace(/<(pre|template|code)[^>]*?>[\s\S]+?<\/(pre|template|code)>/g, m => m.replace(/:/g, '__colon__')) | ||
.replace(/:(\w+?):/ig, window.emojify || replace) | ||
.replace(/:(\w+?):/ig, (inBrowser && window.emojify) || replace) | ||
.replace(/__colon__/g, ':') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,35 @@ | ||
import { History } from './base' | ||
import { parseQuery, stringifyQuery, cleanPath } from '../util' | ||
import { merge } from '../../util/core' | ||
|
||
export class AbstractHistory extends History { | ||
constructor (config) { | ||
super(config) | ||
this.mode = 'abstract' | ||
} | ||
|
||
parse (path) { | ||
let query = '' | ||
|
||
const queryIndex = path.indexOf('?') | ||
if (queryIndex >= 0) { | ||
query = path.slice(queryIndex + 1) | ||
path = path.slice(0, queryIndex) | ||
} | ||
|
||
return { path, query: parseQuery(query) } | ||
} | ||
|
||
toURL (path, params, currentRoute) { | ||
const local = currentRoute && path[0] === '#' | ||
const route = this.parse(path) | ||
|
||
route.query = merge({}, route.query, params) | ||
path = route.path + stringifyQuery(route.query) | ||
path = path.replace(/\.md(\?)|\.md$/, '$1') | ||
|
||
if (local) path = currentRoute + path | ||
|
||
return cleanPath('/' + path) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters