Skip to content

Commit

Permalink
Add support for box-drawing chars and symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
Golmote committed Dec 14, 2014
1 parent b89c5a6 commit b06809b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Include the CSS file after Prism theme, and the JS file after Prism core.
| | `-- [dir] going deeper
| | `-- .secret_file
| |-- style.css
| |-- [dir] symlink -> /some/other/location
| `-- index.html
|-- [dir] music and movies
| |-- great-song.mp3
Expand All @@ -49,3 +50,17 @@ Include the CSS file after Prism theme, and the JS file after Prism core.

## Result
![Result](http://puu.sh/dtsyQ/3924fc9670.png)

## Alternative syntax

You can also use the following box-drawing characters to represent the tree : `─│└├`

```html
<pre><code class="language-treeview">
[dir] root_folder
├── [dir] a first folder
│ ├── holidays.mov
│ ├── javascript-file.js
│ └── some_picture.jpg
└── etc.
</code></pre>
13 changes: 8 additions & 5 deletions prism-treeview.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,28 @@ Prism.languages.treeview = {
inside: {
"entry-line": [
{
pattern: /\|-- /,
pattern: /\|-- |├── /,
alias: "line-h"
},
{
pattern: /\| /,
pattern: /\| |│ /,
alias: "line-v"
},
{
pattern: /`-- */,
pattern: /`-- |└── /,
alias: "line-v-last"
},
{
pattern: / {4}/,
alias: "line-v-gap"
}
],
//"entry-line-break": /\n/,
"entry-name": {
pattern: /.*\S.*/
pattern: /.*\S.*/,
inside: {
// symlink
"operator": / -> /,
}
}
}
}
Expand Down

0 comments on commit b06809b

Please sign in to comment.