mirror of
https://github.com/amix/vimrc
synced 2025-07-09 10:45:00 +08:00
Add markdown preview, update rust.vim
This commit is contained in:
BIN
sources_non_forked/markdown-preview.nvim/app/_static/favicon.ico
Normal file
BIN
sources_non_forked/markdown-preview.nvim/app/_static/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
7
sources_non_forked/markdown-preview.nvim/app/_static/flowchart@1.13.0.min.js
vendored
Normal file
7
sources_non_forked/markdown-preview.nvim/app/_static/flowchart@1.13.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -0,0 +1,105 @@
|
||||
/*
|
||||
|
||||
github.com style (c) Vasily Polovnyov <vast@whiteants.net>
|
||||
|
||||
*/
|
||||
:root {
|
||||
--color-text-primary: #333;
|
||||
}
|
||||
[data-theme="dark"] {
|
||||
--color-text-primary: #c9d1d9;
|
||||
}
|
||||
|
||||
.hljs {
|
||||
display: block;
|
||||
overflow-x: auto;
|
||||
padding: 0.5em;
|
||||
color: var(--color-text-primary);
|
||||
background: #f8f8f8;
|
||||
}
|
||||
|
||||
.hljs-comment,
|
||||
.hljs-quote {
|
||||
color: #998;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hljs-keyword,
|
||||
.hljs-selector-tag,
|
||||
.hljs-subst {
|
||||
color: var(--color-text-primary);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-number,
|
||||
.hljs-literal,
|
||||
.hljs-variable,
|
||||
.hljs-template-variable,
|
||||
.hljs-tag .hljs-attr {
|
||||
color: #008080;
|
||||
}
|
||||
|
||||
.hljs-string,
|
||||
.hljs-doctag {
|
||||
color: #d14;
|
||||
}
|
||||
|
||||
.hljs-title,
|
||||
.hljs-section,
|
||||
.hljs-selector-id {
|
||||
color: #900;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-subst {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.hljs-type,
|
||||
.hljs-class .hljs-title {
|
||||
color: #458;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-tag,
|
||||
.hljs-name,
|
||||
.hljs-attribute {
|
||||
color: #000080;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.hljs-regexp,
|
||||
.hljs-link {
|
||||
color: #009926;
|
||||
}
|
||||
|
||||
.hljs-symbol,
|
||||
.hljs-bullet {
|
||||
color: #990073;
|
||||
}
|
||||
|
||||
.hljs-built_in,
|
||||
.hljs-builtin-name {
|
||||
color: #0086b3;
|
||||
}
|
||||
|
||||
.hljs-meta {
|
||||
color: #999;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-deletion {
|
||||
background: #fdd;
|
||||
}
|
||||
|
||||
.hljs-addition {
|
||||
background: #dfd;
|
||||
}
|
||||
|
||||
.hljs-emphasis {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hljs-strong {
|
||||
font-weight: bold;
|
||||
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1,311 @@
|
||||
/*
|
||||
* github like style
|
||||
* https://github.com/iamcco/markdown.css/blob/master/dest/github/markdown.css
|
||||
*/
|
||||
|
||||
:root {
|
||||
--color-text-primary: #333;
|
||||
--color-text-tertiary: #777;
|
||||
--color-text-link: #4078c0;
|
||||
--color-bg-primary: #fff;
|
||||
--color-bg-secondary: #fafbfc;
|
||||
--color-bg-tertiary: #f8f8f8;
|
||||
--color-border-primary: #ddd;
|
||||
--color-border-secondary: #eaecef;
|
||||
--color-border-tertiary: #d1d5da;
|
||||
--color-kbd-foreground: #444d56;
|
||||
--color-markdown-blockquote-border: #dfe2e5;
|
||||
--color-markdown-table-border: #dfe2e5;
|
||||
--color-markdown-table-tr-border: #c6cbd1;
|
||||
--color-markdown-code-bg: #1b1f230d;
|
||||
}
|
||||
[data-theme="dark"] {
|
||||
--color-text-primary: #c9d1d9;
|
||||
--color-text-tertiary: #8b949e;
|
||||
--color-text-link: #58a6ff;
|
||||
--color-bg-primary: #0d1117;
|
||||
--color-bg-secondary: #0d1117;
|
||||
--color-bg-tertiary: #161b22;
|
||||
--color-border-primary: #30363d;
|
||||
--color-border-secondary: #21262d;
|
||||
--color-border-tertiary: #6e7681;
|
||||
--color-kbd-foreground: #b1bac4;
|
||||
--color-markdown-blockquote-border: #3b434b;
|
||||
--color-markdown-table-border: #3b434b;
|
||||
--color-markdown-table-tr-border: #272c32;
|
||||
--color-markdown-code-bg: #f0f6fc26;
|
||||
}
|
||||
|
||||
.markdown-body ol ol,
|
||||
.markdown-body ul ol,
|
||||
.markdown-body ol ul,
|
||||
.markdown-body ul ul,
|
||||
.markdown-body ol ul ol,
|
||||
.markdown-body ul ul ol,
|
||||
.markdown-body ol ul ul,
|
||||
.markdown-body ul ul ul {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.markdown-body {
|
||||
font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
font-size: 16px;
|
||||
color: var(--color-text-primary);
|
||||
line-height: 1.6;
|
||||
word-wrap: break-word;
|
||||
padding: 45px;
|
||||
background: var(--color-bg-primary);
|
||||
border: 1px solid var(--color-border-primary);
|
||||
-webkit-border-radius: 0 0 3px 3px;
|
||||
border-radius: 0 0 3px 3px;
|
||||
}
|
||||
.markdown-body > *:first-child {
|
||||
margin-top: 0 !important;
|
||||
}
|
||||
.markdown-body > *:last-child {
|
||||
margin-bottom: 0 !important;
|
||||
}
|
||||
.markdown-body .table-of-contents ol {
|
||||
list-style: none;
|
||||
}
|
||||
.markdown-body .table-of-contents > ol {
|
||||
padding-left: 0;
|
||||
}
|
||||
.markdown-body * {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.markdown-body h1,
|
||||
.markdown-body h2,
|
||||
.markdown-body h3,
|
||||
.markdown-body h4,
|
||||
.markdown-body h5,
|
||||
.markdown-body h6 {
|
||||
margin-top: 1em;
|
||||
margin-bottom: 16px;
|
||||
font-weight: bold;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.markdown-body h1 .anchor,
|
||||
.markdown-body h2 .anchor,
|
||||
.markdown-body h3 .anchor,
|
||||
.markdown-body h4 .anchor,
|
||||
.markdown-body h5 .anchor,
|
||||
.markdown-body h6 .anchor {
|
||||
margin-left: -24px;
|
||||
visibility: hidden;
|
||||
}
|
||||
.markdown-body h1:hover .anchor,
|
||||
.markdown-body h2:hover .anchor,
|
||||
.markdown-body h3:hover .anchor,
|
||||
.markdown-body h4:hover .anchor,
|
||||
.markdown-body h5:hover .anchor,
|
||||
.markdown-body h6:hover .anchor {
|
||||
visibility: visible;
|
||||
}
|
||||
.markdown-body p,
|
||||
.markdown-body blockquote,
|
||||
.markdown-body ul,
|
||||
.markdown-body ol,
|
||||
.markdown-body dl,
|
||||
.markdown-body table,
|
||||
.markdown-body pre {
|
||||
margin-top: 0;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.markdown-body h1 {
|
||||
margin: 0.67em 0;
|
||||
padding-bottom: 0.3em;
|
||||
font-size: 2.25em;
|
||||
line-height: 1.2;
|
||||
border-bottom: 1px solid var(--color-border-secondary);
|
||||
}
|
||||
.markdown-body h2 {
|
||||
padding-bottom: 0.3em;
|
||||
font-size: 1.75em;
|
||||
line-height: 1.225;
|
||||
border-bottom: 1px solid var(--color-border-secondary);
|
||||
}
|
||||
.markdown-body h3 {
|
||||
font-size: 1.5em;
|
||||
line-height: 1.43;
|
||||
}
|
||||
.markdown-body h4 {
|
||||
font-size: 1.25em;
|
||||
}
|
||||
.markdown-body h5 {
|
||||
font-size: 1em;
|
||||
}
|
||||
.markdown-body h6 {
|
||||
font-size: 1em;
|
||||
color: var(--color-text-tertiary);
|
||||
}
|
||||
.markdown-body hr {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
height: 0;
|
||||
border: 0;
|
||||
border-top: 1px solid var(--color-border-primary);
|
||||
}
|
||||
.markdown-body ol,
|
||||
.markdown-body ul {
|
||||
padding-left: 2em;
|
||||
}
|
||||
.markdown-body ol ol,
|
||||
.markdown-body ul ol {
|
||||
list-style-type: lower-roman;
|
||||
}
|
||||
.markdown-body ol ul,
|
||||
.markdown-body ul ul {
|
||||
list-style-type: circle;
|
||||
}
|
||||
.markdown-body ol ul ul,
|
||||
.markdown-body ul ul ul {
|
||||
list-style-type: square;
|
||||
}
|
||||
.markdown-body ol {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
.markdown-body ul {
|
||||
list-style-type: disc;
|
||||
}
|
||||
.markdown-body dl {
|
||||
margin-bottom: 1.3em
|
||||
}
|
||||
.markdown-body dl dt {
|
||||
font-weight: 700;
|
||||
}
|
||||
.markdown-body dl dd {
|
||||
margin-left: 0;
|
||||
}
|
||||
.markdown-body dl dd p {
|
||||
margin-bottom: 0.8em;
|
||||
}
|
||||
.markdown-body blockquote {
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
padding: 0 15px;
|
||||
color: var(--color-text-tertiary);
|
||||
border-left: 4px solid var(--color-markdown-blockquote-border);
|
||||
}
|
||||
.markdown-body table {
|
||||
display: block;
|
||||
width: 100%;
|
||||
overflow: auto;
|
||||
word-break: normal;
|
||||
word-break: keep-all;
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
.markdown-body table tr {
|
||||
background-color: var(--color-bg-primary);
|
||||
border-top: 1px solid var(--color-markdown-table-tr-border);
|
||||
}
|
||||
.markdown-body table tr:nth-child(2n) {
|
||||
background-color: var(--color-bg-tertiary);
|
||||
}
|
||||
.markdown-body table th,
|
||||
.markdown-body table td {
|
||||
padding: 6px 13px;
|
||||
border: 1px solid var(--color-markdown-table-border);
|
||||
vertical-align: top;
|
||||
}
|
||||
.markdown-body kbd {
|
||||
display: inline-block;
|
||||
padding: 5px 6px;
|
||||
font: 14px SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace;
|
||||
line-height: 10px;
|
||||
color: var(--color-kbd-foreground);
|
||||
vertical-align: middle;
|
||||
background-color: var(--color-bg-secondary);
|
||||
border: 1px solid var(--color-border-tertiary);
|
||||
border-radius: 3px;
|
||||
box-shadow: inset 0 -1px 0 var(--color-border-tertiary);
|
||||
}
|
||||
.markdown-body pre {
|
||||
word-wrap: normal;
|
||||
padding: 16px;
|
||||
overflow: auto;
|
||||
font-size: 85%;
|
||||
line-height: 1.45;
|
||||
background-color: var(--color-bg-tertiary);
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.markdown-body pre code {
|
||||
display: inline;
|
||||
max-width: initial;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
overflow: initial;
|
||||
font-size: 100%;
|
||||
line-height: inherit;
|
||||
word-wrap: normal;
|
||||
white-space: pre;
|
||||
border: 0;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
background-color: transparent;
|
||||
}
|
||||
.markdown-body pre code:before,
|
||||
.markdown-body pre code:after {
|
||||
content: normal;
|
||||
}
|
||||
.markdown-body code {
|
||||
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||
padding: 0;
|
||||
padding-top: 0.2em;
|
||||
padding-bottom: 0.2em;
|
||||
margin: 0;
|
||||
font-size: 85%;
|
||||
background-color: var(--color-markdown-code-bg);
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.markdown-body code:before,
|
||||
.markdown-body code:after {
|
||||
letter-spacing: -0.2em;
|
||||
content: "\00a0";
|
||||
}
|
||||
.markdown-body a {
|
||||
color: var(--color-text-link);
|
||||
text-decoration: none;
|
||||
background: transparent;
|
||||
}
|
||||
.markdown-body img {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
.markdown-body strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
.markdown-body em {
|
||||
font-style: italic;
|
||||
}
|
||||
.markdown-body del {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
.task-list-item {
|
||||
list-style-type: none;
|
||||
}
|
||||
.task-list-item input {
|
||||
font: 13px/1.4 Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
margin: 0 0.35em 0.25em -1.6em;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.task-list-item input[disabled] {
|
||||
cursor: default;
|
||||
}
|
||||
.task-list-item input[type="checkbox"] {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
}
|
||||
.task-list-item input[type="radio"] {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
}
|
3
sources_non_forked/markdown-preview.nvim/app/_static/mermaid.min.js
vendored
Normal file
3
sources_non_forked/markdown-preview.nvim/app/_static/mermaid.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
sources_non_forked/markdown-preview.nvim/app/_static/mhchem.min.js
vendored
Normal file
1
sources_non_forked/markdown-preview.nvim/app/_static/mhchem.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,76 @@
|
||||
html,body,#__next,main {
|
||||
min-height: 100vh;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:root {
|
||||
--foreground-color: #24292e;
|
||||
--background-color: #f6f8fa;
|
||||
--border-color: #d1d5da;
|
||||
}
|
||||
|
||||
body {
|
||||
--secondary-background-color: #f6f8fa;
|
||||
}
|
||||
|
||||
[data-theme="dark"] {
|
||||
--foreground-color: #c9d1d9;
|
||||
--background-color: #0d1117;
|
||||
--border-color: #30363d;
|
||||
--secondary-background-color: #181a1b;
|
||||
}
|
||||
|
||||
main {
|
||||
background-color: var(--secondary-background-color);
|
||||
}
|
||||
|
||||
#toggle-theme {
|
||||
float: left;
|
||||
vertical-align: middle;
|
||||
height: 24px;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#toggle-theme input,
|
||||
#toggle-theme span {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
#page-ctn {
|
||||
margin: 0 auto;
|
||||
max-width: 900px;
|
||||
color: var(--foreground-color);
|
||||
}
|
||||
|
||||
#page-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 8px;
|
||||
background-color: var(--background-color);
|
||||
border-color: var(--border-color);
|
||||
border-style: solid;
|
||||
border-width: 1px 1px 0;
|
||||
border-top-left-radius: 3px;
|
||||
border-top-right-radius: 3px;
|
||||
line-height: 24px;
|
||||
font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, freesans, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
|
||||
}
|
||||
|
||||
#page-header svg {
|
||||
display: inline-block;
|
||||
margin-right: 5px;
|
||||
overflow: hidden;
|
||||
fill: currentColor;
|
||||
}
|
||||
|
||||
#page-header h3 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
padding-right: 16px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
1
sources_non_forked/markdown-preview.nvim/app/_static/raphael@2.3.0.min.js
vendored
Normal file
1
sources_non_forked/markdown-preview.nvim/app/_static/raphael@2.3.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
sources_non_forked/markdown-preview.nvim/app/_static/sequence-diagram-min.css
vendored
Normal file
6
sources_non_forked/markdown-preview.nvim/app/_static/sequence-diagram-min.css
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
/** js sequence diagrams
|
||||
* https://bramp.github.io/js-sequence-diagrams/
|
||||
* (c) 2012-2017 Andrew Brampton (bramp.net)
|
||||
* Simplified BSD license.
|
||||
*/
|
||||
@font-face{font-family:'danielbd';src:url(/_static/fonts/danielbd.woff2) format('woff2'),url(/_static/fonts/danielbd.woff) format('woff');font-weight:normal;font-style:normal}
|
9
sources_non_forked/markdown-preview.nvim/app/_static/sequence-diagram-min.js
vendored
Normal file
9
sources_non_forked/markdown-preview.nvim/app/_static/sequence-diagram-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
21
sources_non_forked/markdown-preview.nvim/app/_static/snap.svg.min.js
vendored
Normal file
21
sources_non_forked/markdown-preview.nvim/app/_static/snap.svg.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
12
sources_non_forked/markdown-preview.nvim/app/_static/tweenlite.min.js
vendored
Normal file
12
sources_non_forked/markdown-preview.nvim/app/_static/tweenlite.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
sources_non_forked/markdown-preview.nvim/app/_static/underscore-min.js
vendored
Normal file
5
sources_non_forked/markdown-preview.nvim/app/_static/underscore-min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
333
sources_non_forked/markdown-preview.nvim/app/_static/viz.js
Normal file
333
sources_non_forked/markdown-preview.nvim/app/_static/viz.js
Normal file
@ -0,0 +1,333 @@
|
||||
/*
|
||||
Viz.js 2.1.2 (Graphviz 2.40.1, Expat 2.2.5, Emscripten 1.37.36)
|
||||
Copyright (c) 2014-2018 Michael Daines
|
||||
Licensed under MIT license
|
||||
|
||||
This distribution contains other software in object code form:
|
||||
|
||||
Graphviz
|
||||
Licensed under Eclipse Public License - v 1.0
|
||||
http://www.graphviz.org
|
||||
|
||||
Expat
|
||||
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd and Clark Cooper
|
||||
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers.
|
||||
Licensed under MIT license
|
||||
http://www.libexpat.org
|
||||
|
||||
zlib
|
||||
Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler
|
||||
http://www.zlib.net/zlib_license.html
|
||||
*/
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global.Viz = factory());
|
||||
}(this, (function () { 'use strict';
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
|
||||
return typeof obj;
|
||||
} : function (obj) {
|
||||
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
||||
};
|
||||
|
||||
var classCallCheck = function (instance, Constructor) {
|
||||
if (!(instance instanceof Constructor)) {
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
};
|
||||
|
||||
var createClass = function () {
|
||||
function defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if ("value" in descriptor) descriptor.writable = true;
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
return function (Constructor, protoProps, staticProps) {
|
||||
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
};
|
||||
}();
|
||||
|
||||
var _extends = Object.assign || function (target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i];
|
||||
|
||||
for (var key in source) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
};
|
||||
|
||||
var WorkerWrapper = function () {
|
||||
function WorkerWrapper(worker) {
|
||||
var _this = this;
|
||||
|
||||
classCallCheck(this, WorkerWrapper);
|
||||
|
||||
this.worker = worker;
|
||||
this.listeners = [];
|
||||
this.nextId = 0;
|
||||
|
||||
this.worker.addEventListener('message', function (event) {
|
||||
var id = event.data.id;
|
||||
var error = event.data.error;
|
||||
var result = event.data.result;
|
||||
|
||||
_this.listeners[id](error, result);
|
||||
delete _this.listeners[id];
|
||||
});
|
||||
}
|
||||
|
||||
createClass(WorkerWrapper, [{
|
||||
key: 'render',
|
||||
value: function render(src, options) {
|
||||
var _this2 = this;
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
var id = _this2.nextId++;
|
||||
|
||||
_this2.listeners[id] = function (error, result) {
|
||||
if (error) {
|
||||
reject(new Error(error.message, error.fileName, error.lineNumber));
|
||||
return;
|
||||
}
|
||||
resolve(result);
|
||||
};
|
||||
|
||||
_this2.worker.postMessage({ id: id, src: src, options: options });
|
||||
});
|
||||
}
|
||||
}]);
|
||||
return WorkerWrapper;
|
||||
}();
|
||||
|
||||
var ModuleWrapper = function ModuleWrapper(module, render) {
|
||||
classCallCheck(this, ModuleWrapper);
|
||||
|
||||
var instance = module();
|
||||
this.render = function (src, options) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
try {
|
||||
resolve(render(instance, src, options));
|
||||
} catch (error) {
|
||||
reject(error);
|
||||
}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
|
||||
|
||||
|
||||
function b64EncodeUnicode(str) {
|
||||
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) {
|
||||
return String.fromCharCode('0x' + p1);
|
||||
}));
|
||||
}
|
||||
|
||||
function defaultScale() {
|
||||
if ('devicePixelRatio' in window && window.devicePixelRatio > 1) {
|
||||
return window.devicePixelRatio;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
function svgXmlToImageElement(svgXml) {
|
||||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
||||
_ref$scale = _ref.scale,
|
||||
scale = _ref$scale === undefined ? defaultScale() : _ref$scale,
|
||||
_ref$mimeType = _ref.mimeType,
|
||||
mimeType = _ref$mimeType === undefined ? "image/png" : _ref$mimeType,
|
||||
_ref$quality = _ref.quality,
|
||||
quality = _ref$quality === undefined ? 1 : _ref$quality;
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
var svgImage = new Image();
|
||||
|
||||
svgImage.onload = function () {
|
||||
var canvas = document.createElement('canvas');
|
||||
canvas.width = svgImage.width * scale;
|
||||
canvas.height = svgImage.height * scale;
|
||||
|
||||
var context = canvas.getContext("2d");
|
||||
context.drawImage(svgImage, 0, 0, canvas.width, canvas.height);
|
||||
|
||||
canvas.toBlob(function (blob) {
|
||||
var image = new Image();
|
||||
image.src = URL.createObjectURL(blob);
|
||||
image.width = svgImage.width;
|
||||
image.height = svgImage.height;
|
||||
|
||||
resolve(image);
|
||||
}, mimeType, quality);
|
||||
};
|
||||
|
||||
svgImage.onerror = function (e) {
|
||||
var error;
|
||||
|
||||
if ('error' in e) {
|
||||
error = e.error;
|
||||
} else {
|
||||
error = new Error('Error loading SVG');
|
||||
}
|
||||
|
||||
reject(error);
|
||||
};
|
||||
|
||||
svgImage.src = 'data:image/svg+xml;base64,' + b64EncodeUnicode(svgXml);
|
||||
});
|
||||
}
|
||||
|
||||
function svgXmlToImageElementFabric(svgXml) {
|
||||
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
||||
_ref2$scale = _ref2.scale,
|
||||
scale = _ref2$scale === undefined ? defaultScale() : _ref2$scale,
|
||||
_ref2$mimeType = _ref2.mimeType,
|
||||
mimeType = _ref2$mimeType === undefined ? 'image/png' : _ref2$mimeType,
|
||||
_ref2$quality = _ref2.quality,
|
||||
quality = _ref2$quality === undefined ? 1 : _ref2$quality;
|
||||
|
||||
var multiplier = scale;
|
||||
|
||||
var format = void 0;
|
||||
if (mimeType == 'image/jpeg') {
|
||||
format = 'jpeg';
|
||||
} else if (mimeType == 'image/png') {
|
||||
format = 'png';
|
||||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
fabric.loadSVGFromString(svgXml, function (objects, options) {
|
||||
// If there's something wrong with the SVG, Fabric may return an empty array of objects. Graphviz appears to give us at least one <g> element back even given an empty graph, so we will assume an error in this case.
|
||||
if (objects.length == 0) {
|
||||
reject(new Error('Error loading SVG with Fabric'));
|
||||
}
|
||||
|
||||
var element = document.createElement("canvas");
|
||||
element.width = options.width;
|
||||
element.height = options.height;
|
||||
|
||||
var canvas = new fabric.Canvas(element, { enableRetinaScaling: false });
|
||||
var obj = fabric.util.groupSVGElements(objects, options);
|
||||
canvas.add(obj).renderAll();
|
||||
|
||||
var image = new Image();
|
||||
image.src = canvas.toDataURL({ format: format, multiplier: multiplier, quality: quality });
|
||||
image.width = options.width;
|
||||
image.height = options.height;
|
||||
|
||||
resolve(image);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var Viz = function () {
|
||||
function Viz() {
|
||||
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
||||
workerURL = _ref3.workerURL,
|
||||
worker = _ref3.worker,
|
||||
Module = _ref3.Module,
|
||||
render = _ref3.render;
|
||||
|
||||
classCallCheck(this, Viz);
|
||||
|
||||
if (typeof workerURL !== 'undefined') {
|
||||
this.wrapper = new WorkerWrapper(new Worker(workerURL));
|
||||
} else if (typeof worker !== 'undefined') {
|
||||
this.wrapper = new WorkerWrapper(worker);
|
||||
} else if (typeof Module !== 'undefined' && typeof render !== 'undefined') {
|
||||
this.wrapper = new ModuleWrapper(Module, render);
|
||||
} else if (typeof Viz.Module !== 'undefined' && typeof Viz.render !== 'undefined') {
|
||||
this.wrapper = new ModuleWrapper(Viz.Module, Viz.render);
|
||||
} else {
|
||||
throw new Error('Must specify workerURL or worker option, Module and render options, or include one of full.render.js or lite.render.js after viz.js.');
|
||||
}
|
||||
}
|
||||
|
||||
createClass(Viz, [{
|
||||
key: 'renderString',
|
||||
value: function renderString(src) {
|
||||
var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
||||
_ref4$format = _ref4.format,
|
||||
format = _ref4$format === undefined ? 'svg' : _ref4$format,
|
||||
_ref4$engine = _ref4.engine,
|
||||
engine = _ref4$engine === undefined ? 'dot' : _ref4$engine,
|
||||
_ref4$files = _ref4.files,
|
||||
files = _ref4$files === undefined ? [] : _ref4$files,
|
||||
_ref4$images = _ref4.images,
|
||||
images = _ref4$images === undefined ? [] : _ref4$images,
|
||||
_ref4$yInvert = _ref4.yInvert,
|
||||
yInvert = _ref4$yInvert === undefined ? false : _ref4$yInvert,
|
||||
_ref4$nop = _ref4.nop,
|
||||
nop = _ref4$nop === undefined ? 0 : _ref4$nop;
|
||||
|
||||
for (var i = 0; i < images.length; i++) {
|
||||
files.push({
|
||||
path: images[i].path,
|
||||
data: '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg width="' + images[i].width + '" height="' + images[i].height + '"></svg>'
|
||||
});
|
||||
}
|
||||
|
||||
return this.wrapper.render(src, { format: format, engine: engine, files: files, images: images, yInvert: yInvert, nop: nop });
|
||||
}
|
||||
}, {
|
||||
key: 'renderSVGElement',
|
||||
value: function renderSVGElement(src) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
return this.renderString(src, _extends({}, options, { format: 'svg' })).then(function (str) {
|
||||
var parser = new DOMParser();
|
||||
return parser.parseFromString(str, 'image/svg+xml').documentElement;
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'renderImageElement',
|
||||
value: function renderImageElement(src) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
var scale = options.scale,
|
||||
mimeType = options.mimeType,
|
||||
quality = options.quality;
|
||||
|
||||
|
||||
return this.renderString(src, _extends({}, options, { format: 'svg' })).then(function (str) {
|
||||
if ((typeof fabric === 'undefined' ? 'undefined' : _typeof(fabric)) === "object" && fabric.loadSVGFromString) {
|
||||
return svgXmlToImageElementFabric(str, { scale: scale, mimeType: mimeType, quality: quality });
|
||||
} else {
|
||||
return svgXmlToImageElement(str, { scale: scale, mimeType: mimeType, quality: quality });
|
||||
}
|
||||
});
|
||||
}
|
||||
}, {
|
||||
key: 'renderJSONObject',
|
||||
value: function renderJSONObject(src) {
|
||||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
var format = options.format;
|
||||
|
||||
|
||||
if (format !== 'json' || format !== 'json0') {
|
||||
format = 'json';
|
||||
}
|
||||
|
||||
return this.renderString(src, _extends({}, options, { format: format })).then(function (str) {
|
||||
return JSON.parse(str);
|
||||
});
|
||||
}
|
||||
}]);
|
||||
return Viz;
|
||||
}();
|
||||
|
||||
return Viz;
|
||||
|
||||
})));
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright 2016 Small Batch, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||
* use this file except in compliance with the License. You may obtain a copy of
|
||||
* the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
/* Web Font Loader v1.6.26 - (c) Adobe Systems, Google. License: Apache 2.0 */(function(){function aa(a,b,c){return a.call.apply(a.bind,arguments)}function ba(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function p(a,b,c){p=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?aa:ba;return p.apply(null,arguments)}var q=Date.now||function(){return+new Date};function ca(a,b){this.a=a;this.m=b||a;this.c=this.m.document}var da=!!window.FontFace;function t(a,b,c,d){b=a.c.createElement(b);if(c)for(var e in c)c.hasOwnProperty(e)&&("style"==e?b.style.cssText=c[e]:b.setAttribute(e,c[e]));d&&b.appendChild(a.c.createTextNode(d));return b}function u(a,b,c){a=a.c.getElementsByTagName(b)[0];a||(a=document.documentElement);a.insertBefore(c,a.lastChild)}function v(a){a.parentNode&&a.parentNode.removeChild(a)}
|
||||
function w(a,b,c){b=b||[];c=c||[];for(var d=a.className.split(/\s+/),e=0;e<b.length;e+=1){for(var f=!1,g=0;g<d.length;g+=1)if(b[e]===d[g]){f=!0;break}f||d.push(b[e])}b=[];for(e=0;e<d.length;e+=1){f=!1;for(g=0;g<c.length;g+=1)if(d[e]===c[g]){f=!0;break}f||b.push(d[e])}a.className=b.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function y(a,b){for(var c=a.className.split(/\s+/),d=0,e=c.length;d<e;d++)if(c[d]==b)return!0;return!1}
|
||||
function z(a){if("string"===typeof a.f)return a.f;var b=a.m.location.protocol;"about:"==b&&(b=a.a.location.protocol);return"https:"==b?"https:":"http:"}function ea(a){return a.m.location.hostname||a.a.location.hostname}
|
||||
function A(a,b,c){function d(){k&&e&&f&&(k(g),k=null)}b=t(a,"link",{rel:"stylesheet",href:b,media:"all"});var e=!1,f=!0,g=null,k=c||null;da?(b.onload=function(){e=!0;d()},b.onerror=function(){e=!0;g=Error("Stylesheet failed to load");d()}):setTimeout(function(){e=!0;d()},0);u(a,"head",b)}
|
||||
function B(a,b,c,d){var e=a.c.getElementsByTagName("head")[0];if(e){var f=t(a,"script",{src:b}),g=!1;f.onload=f.onreadystatechange=function(){g||this.readyState&&"loaded"!=this.readyState&&"complete"!=this.readyState||(g=!0,c&&c(null),f.onload=f.onreadystatechange=null,"HEAD"==f.parentNode.tagName&&e.removeChild(f))};e.appendChild(f);setTimeout(function(){g||(g=!0,c&&c(Error("Script load timeout")))},d||5E3);return f}return null};function C(){this.a=0;this.c=null}function D(a){a.a++;return function(){a.a--;E(a)}}function F(a,b){a.c=b;E(a)}function E(a){0==a.a&&a.c&&(a.c(),a.c=null)};function G(a){this.a=a||"-"}G.prototype.c=function(a){for(var b=[],c=0;c<arguments.length;c++)b.push(arguments[c].replace(/[\W_]+/g,"").toLowerCase());return b.join(this.a)};function H(a,b){this.c=a;this.f=4;this.a="n";var c=(b||"n4").match(/^([nio])([1-9])$/i);c&&(this.a=c[1],this.f=parseInt(c[2],10))}function fa(a){return I(a)+" "+(a.f+"00")+" 300px "+J(a.c)}function J(a){var b=[];a=a.split(/,\s*/);for(var c=0;c<a.length;c++){var d=a[c].replace(/['"]/g,"");-1!=d.indexOf(" ")||/^\d/.test(d)?b.push("'"+d+"'"):b.push(d)}return b.join(",")}function K(a){return a.a+a.f}function I(a){var b="normal";"o"===a.a?b="oblique":"i"===a.a&&(b="italic");return b}
|
||||
function ga(a){var b=4,c="n",d=null;a&&((d=a.match(/(normal|oblique|italic)/i))&&d[1]&&(c=d[1].substr(0,1).toLowerCase()),(d=a.match(/([1-9]00|normal|bold)/i))&&d[1]&&(/bold/i.test(d[1])?b=7:/[1-9]00/.test(d[1])&&(b=parseInt(d[1].substr(0,1),10))));return c+b};function ha(a,b){this.c=a;this.f=a.m.document.documentElement;this.h=b;this.a=new G("-");this.j=!1!==b.events;this.g=!1!==b.classes}function ia(a){a.g&&w(a.f,[a.a.c("wf","loading")]);L(a,"loading")}function M(a){if(a.g){var b=y(a.f,a.a.c("wf","active")),c=[],d=[a.a.c("wf","loading")];b||c.push(a.a.c("wf","inactive"));w(a.f,c,d)}L(a,"inactive")}function L(a,b,c){if(a.j&&a.h[b])if(c)a.h[b](c.c,K(c));else a.h[b]()};function ja(){this.c={}}function ka(a,b,c){var d=[],e;for(e in b)if(b.hasOwnProperty(e)){var f=a.c[e];f&&d.push(f(b[e],c))}return d};function N(a,b){this.c=a;this.f=b;this.a=t(this.c,"span",{"aria-hidden":"true"},this.f)}function O(a){u(a.c,"body",a.a)}function P(a){return"display:block;position:absolute;top:-9999px;left:-9999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:"+J(a.c)+";"+("font-style:"+I(a)+";font-weight:"+(a.f+"00")+";")};function Q(a,b,c,d,e,f){this.g=a;this.j=b;this.a=d;this.c=c;this.f=e||3E3;this.h=f||void 0}Q.prototype.start=function(){var a=this.c.m.document,b=this,c=q(),d=new Promise(function(d,e){function k(){q()-c>=b.f?e():a.fonts.load(fa(b.a),b.h).then(function(a){1<=a.length?d():setTimeout(k,25)},function(){e()})}k()}),e=new Promise(function(a,d){setTimeout(d,b.f)});Promise.race([e,d]).then(function(){b.g(b.a)},function(){b.j(b.a)})};function R(a,b,c,d,e,f,g){this.v=a;this.B=b;this.c=c;this.a=d;this.s=g||"BESbswy";this.f={};this.w=e||3E3;this.u=f||null;this.o=this.j=this.h=this.g=null;this.g=new N(this.c,this.s);this.h=new N(this.c,this.s);this.j=new N(this.c,this.s);this.o=new N(this.c,this.s);a=new H(this.a.c+",serif",K(this.a));a=P(a);this.g.a.style.cssText=a;a=new H(this.a.c+",sans-serif",K(this.a));a=P(a);this.h.a.style.cssText=a;a=new H("serif",K(this.a));a=P(a);this.j.a.style.cssText=a;a=new H("sans-serif",K(this.a));a=
|
||||
P(a);this.o.a.style.cssText=a;O(this.g);O(this.h);O(this.j);O(this.o)}var S={D:"serif",C:"sans-serif"},T=null;function U(){if(null===T){var a=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent);T=!!a&&(536>parseInt(a[1],10)||536===parseInt(a[1],10)&&11>=parseInt(a[2],10))}return T}R.prototype.start=function(){this.f.serif=this.j.a.offsetWidth;this.f["sans-serif"]=this.o.a.offsetWidth;this.A=q();la(this)};
|
||||
function ma(a,b,c){for(var d in S)if(S.hasOwnProperty(d)&&b===a.f[S[d]]&&c===a.f[S[d]])return!0;return!1}function la(a){var b=a.g.a.offsetWidth,c=a.h.a.offsetWidth,d;(d=b===a.f.serif&&c===a.f["sans-serif"])||(d=U()&&ma(a,b,c));d?q()-a.A>=a.w?U()&&ma(a,b,c)&&(null===a.u||a.u.hasOwnProperty(a.a.c))?V(a,a.v):V(a,a.B):na(a):V(a,a.v)}function na(a){setTimeout(p(function(){la(this)},a),50)}function V(a,b){setTimeout(p(function(){v(this.g.a);v(this.h.a);v(this.j.a);v(this.o.a);b(this.a)},a),0)};function W(a,b,c){this.c=a;this.a=b;this.f=0;this.o=this.j=!1;this.s=c}var X=null;W.prototype.g=function(a){var b=this.a;b.g&&w(b.f,[b.a.c("wf",a.c,K(a).toString(),"active")],[b.a.c("wf",a.c,K(a).toString(),"loading"),b.a.c("wf",a.c,K(a).toString(),"inactive")]);L(b,"fontactive",a);this.o=!0;oa(this)};
|
||||
W.prototype.h=function(a){var b=this.a;if(b.g){var c=y(b.f,b.a.c("wf",a.c,K(a).toString(),"active")),d=[],e=[b.a.c("wf",a.c,K(a).toString(),"loading")];c||d.push(b.a.c("wf",a.c,K(a).toString(),"inactive"));w(b.f,d,e)}L(b,"fontinactive",a);oa(this)};function oa(a){0==--a.f&&a.j&&(a.o?(a=a.a,a.g&&w(a.f,[a.a.c("wf","active")],[a.a.c("wf","loading"),a.a.c("wf","inactive")]),L(a,"active")):M(a.a))};function pa(a){this.j=a;this.a=new ja;this.h=0;this.f=this.g=!0}pa.prototype.load=function(a){this.c=new ca(this.j,a.context||this.j);this.g=!1!==a.events;this.f=!1!==a.classes;qa(this,new ha(this.c,a),a)};
|
||||
function ra(a,b,c,d,e){var f=0==--a.h;(a.f||a.g)&&setTimeout(function(){var a=e||null,k=d||null||{};if(0===c.length&&f)M(b.a);else{b.f+=c.length;f&&(b.j=f);var h,m=[];for(h=0;h<c.length;h++){var l=c[h],n=k[l.c],r=b.a,x=l;r.g&&w(r.f,[r.a.c("wf",x.c,K(x).toString(),"loading")]);L(r,"fontloading",x);r=null;null===X&&(X=window.FontFace?(x=/Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgent))?42<parseInt(x[1],10):!0:!1);X?r=new Q(p(b.g,b),p(b.h,b),b.c,l,b.s,n):r=new R(p(b.g,b),p(b.h,b),b.c,l,b.s,a,
|
||||
n);m.push(r)}for(h=0;h<m.length;h++)m[h].start()}},0)}function qa(a,b,c){var d=[],e=c.timeout;ia(b);var d=ka(a.a,c,a.c),f=new W(a.c,b,e);a.h=d.length;b=0;for(c=d.length;b<c;b++)d[b].load(function(b,d,c){ra(a,f,b,d,c)})};function sa(a,b){this.c=a;this.a=b}function ta(a,b,c){var d=z(a.c);a=(a.a.api||"fast.fonts.net/jsapi").replace(/^.*http(s?):(\/\/)?/,"");return d+"//"+a+"/"+b+".js"+(c?"?v="+c:"")}
|
||||
sa.prototype.load=function(a){function b(){if(f["__mti_fntLst"+d]){var c=f["__mti_fntLst"+d](),e=[],h;if(c)for(var m=0;m<c.length;m++){var l=c[m].fontfamily;void 0!=c[m].fontStyle&&void 0!=c[m].fontWeight?(h=c[m].fontStyle+c[m].fontWeight,e.push(new H(l,h))):e.push(new H(l))}a(e)}else setTimeout(function(){b()},50)}var c=this,d=c.a.projectId,e=c.a.version;if(d){var f=c.c.m;B(this.c,ta(c,d,e),function(e){e?a([]):(f["__MonotypeConfiguration__"+d]=function(){return c.a},b())}).id="__MonotypeAPIScript__"+
|
||||
d}else a([])};function ua(a,b){this.c=a;this.a=b}ua.prototype.load=function(a){var b,c,d=this.a.urls||[],e=this.a.families||[],f=this.a.testStrings||{},g=new C;b=0;for(c=d.length;b<c;b++)A(this.c,d[b],D(g));var k=[];b=0;for(c=e.length;b<c;b++)if(d=e[b].split(":"),d[1])for(var h=d[1].split(","),m=0;m<h.length;m+=1)k.push(new H(d[0],h[m]));else k.push(new H(d[0]));F(g,function(){a(k,f)})};function va(a,b,c){a?this.c=a:this.c=b+wa;this.a=[];this.f=[];this.g=c||""}var wa="//fonts.googleapis.com/css";function xa(a,b){for(var c=b.length,d=0;d<c;d++){var e=b[d].split(":");3==e.length&&a.f.push(e.pop());var f="";2==e.length&&""!=e[1]&&(f=":");a.a.push(e.join(f))}}
|
||||
function ya(a){if(0==a.a.length)throw Error("No fonts to load!");if(-1!=a.c.indexOf("kit="))return a.c;for(var b=a.a.length,c=[],d=0;d<b;d++)c.push(a.a[d].replace(/ /g,"+"));b=a.c+"?family="+c.join("%7C");0<a.f.length&&(b+="&subset="+a.f.join(","));0<a.g.length&&(b+="&text="+encodeURIComponent(a.g));return b};function za(a){this.f=a;this.a=[];this.c={}}
|
||||
var Aa={latin:"BESbswy","latin-ext":"\u00e7\u00f6\u00fc\u011f\u015f",cyrillic:"\u0439\u044f\u0416",greek:"\u03b1\u03b2\u03a3",khmer:"\u1780\u1781\u1782",Hanuman:"\u1780\u1781\u1782"},Ba={thin:"1",extralight:"2","extra-light":"2",ultralight:"2","ultra-light":"2",light:"3",regular:"4",book:"4",medium:"5","semi-bold":"6",semibold:"6","demi-bold":"6",demibold:"6",bold:"7","extra-bold":"8",extrabold:"8","ultra-bold":"8",ultrabold:"8",black:"9",heavy:"9",l:"3",r:"4",b:"7"},Ca={i:"i",italic:"i",n:"n",normal:"n"},
|
||||
Da=/^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;
|
||||
function Ea(a){for(var b=a.f.length,c=0;c<b;c++){var d=a.f[c].split(":"),e=d[0].replace(/\+/g," "),f=["n4"];if(2<=d.length){var g;var k=d[1];g=[];if(k)for(var k=k.split(","),h=k.length,m=0;m<h;m++){var l;l=k[m];if(l.match(/^[\w-]+$/)){var n=Da.exec(l.toLowerCase());if(null==n)l="";else{l=n[2];l=null==l||""==l?"n":Ca[l];n=n[1];if(null==n||""==n)n="4";else var r=Ba[n],n=r?r:isNaN(n)?"4":n.substr(0,1);l=[l,n].join("")}}else l="";l&&g.push(l)}0<g.length&&(f=g);3==d.length&&(d=d[2],g=[],d=d?d.split(","):
|
||||
g,0<d.length&&(d=Aa[d[0]])&&(a.c[e]=d))}a.c[e]||(d=Aa[e])&&(a.c[e]=d);for(d=0;d<f.length;d+=1)a.a.push(new H(e,f[d]))}};function Fa(a,b){this.c=a;this.a=b}var Ga={Arimo:!0,Cousine:!0,Tinos:!0};Fa.prototype.load=function(a){var b=new C,c=this.c,d=new va(this.a.api,z(c),this.a.text),e=this.a.families;xa(d,e);var f=new za(e);Ea(f);A(c,ya(d),D(b));F(b,function(){a(f.a,f.c,Ga)})};function Ha(a,b){this.c=a;this.a=b}Ha.prototype.load=function(a){var b=this.a.id,c=this.c.m;b?B(this.c,(this.a.api||"https://use.typekit.net")+"/"+b+".js",function(b){if(b)a([]);else if(c.Typekit&&c.Typekit.config&&c.Typekit.config.fn){b=c.Typekit.config.fn;for(var e=[],f=0;f<b.length;f+=2)for(var g=b[f],k=b[f+1],h=0;h<k.length;h++)e.push(new H(g,k[h]));try{c.Typekit.load({events:!1,classes:!1,async:!0})}catch(m){}a(e)}},2E3):a([])};function Ia(a,b){this.c=a;this.f=b;this.a=[]}Ia.prototype.load=function(a){var b=this.f.id,c=this.c.m,d=this;b?(c.__webfontfontdeckmodule__||(c.__webfontfontdeckmodule__={}),c.__webfontfontdeckmodule__[b]=function(b,c){for(var g=0,k=c.fonts.length;g<k;++g){var h=c.fonts[g];d.a.push(new H(h.name,ga("font-weight:"+h.weight+";font-style:"+h.style)))}a(d.a)},B(this.c,z(this.c)+(this.f.api||"//f.fontdeck.com/s/css/js/")+ea(this.c)+"/"+b+".js",function(b){b&&a([])})):a([])};var Y=new pa(window);Y.a.c.custom=function(a,b){return new ua(b,a)};Y.a.c.fontdeck=function(a,b){return new Ia(b,a)};Y.a.c.monotype=function(a,b){return new sa(b,a)};Y.a.c.typekit=function(a,b){return new Ha(b,a)};Y.a.c.google=function(a,b){return new Fa(b,a)};var Z={load:p(Y.load,Y)};"function"===typeof define&&define.amd?define(function(){return Z}):"undefined"!==typeof module&&module.exports?module.exports=Z:(window.WebFont=Z,window.WebFontConfig&&Y.load(window.WebFontConfig));}());
|
8
sources_non_forked/markdown-preview.nvim/app/index.js
Normal file
8
sources_non_forked/markdown-preview.nvim/app/index.js
Normal file
@ -0,0 +1,8 @@
|
||||
// change cwd to ./app
|
||||
if (!/^(\/|C:\\)snapshot/.test(__dirname)) {
|
||||
process.chdir(__dirname)
|
||||
} else {
|
||||
process.chdir(process.execPath.replace(/(markdown-preview.nvim.*?app).+?$/, '$1'))
|
||||
}
|
||||
|
||||
require('./lib/app')
|
29
sources_non_forked/markdown-preview.nvim/app/install.cmd
Executable file
29
sources_non_forked/markdown-preview.nvim/app/install.cmd
Executable file
@ -0,0 +1,29 @@
|
||||
@PowerShell -ExecutionPolicy Bypass -Command Invoke-Expression $('$args=@(^&{$args} %*);'+[String]::Join(';',(Get-Content '%~f0') -notmatch '^^@PowerShell.*EOF$')) & goto :EOF
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
$repo = "iamcco/markdown-preview.nvim"
|
||||
$file = "markdown-preview-win.zip"
|
||||
|
||||
$releases = "https://api.github.com/repos/$repo/releases"
|
||||
|
||||
Write-Host Determining latest release
|
||||
if ($args[0]) { $tag = $args[0] } else { $tag = (Invoke-WebRequest $releases | ConvertFrom-Json)[0].tag_name }
|
||||
|
||||
$download = "https://github.com/$repo/releases/download/$tag/$file"
|
||||
$name = $file.Split(".")[0]
|
||||
$zip = "$name-$tag.zip"
|
||||
$dir = "bin"
|
||||
|
||||
new-item -Name $dir -ItemType directory -Force
|
||||
|
||||
Write-Host Dowloading latest release
|
||||
Invoke-WebRequest $download -Out $zip
|
||||
|
||||
Remove-Item $dir\* -Recurse -Force -ErrorAction SilentlyContinue
|
||||
|
||||
Write-Host Extracting release files
|
||||
Expand-Archive $zip -DestinationPath $dir -Force
|
||||
|
||||
Remove-Item $zip -Force
|
||||
Write-Host markdown-preview install completed.
|
85
sources_non_forked/markdown-preview.nvim/app/install.sh
Executable file
85
sources_non_forked/markdown-preview.nvim/app/install.sh
Executable file
@ -0,0 +1,85 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -o nounset # error when referencing undefined variable
|
||||
set -o errexit # exit when command fails
|
||||
|
||||
BOLD="$(tput bold 2>/dev/null || echo '')"
|
||||
GREY="$(tput setaf 0 2>/dev/null || echo '')"
|
||||
BLUE="$(tput setaf 4 2>/dev/null || echo '')"
|
||||
RED="$(tput setaf 1 2>/dev/null || echo '')"
|
||||
NO_COLOR="$(tput sgr0 2>/dev/null || echo '')"
|
||||
YELLOW="$(tput setaf 3 2>/dev/null || echo '')"
|
||||
|
||||
error() {
|
||||
printf "${RED} $@${NO_COLOR}\n" >&2
|
||||
}
|
||||
|
||||
warn() {
|
||||
printf "${YELLOW}! $@${NO_COLOR}\n"
|
||||
}
|
||||
|
||||
info() {
|
||||
printf "${BLUE} $@${NO_COLOR}\n"
|
||||
}
|
||||
|
||||
fetch() {
|
||||
local command
|
||||
if hash curl 2>/dev/null; then
|
||||
set +e
|
||||
command="curl --fail -L $1"
|
||||
curl --compressed --fail -L "$1"
|
||||
rc=$?
|
||||
set -e
|
||||
else
|
||||
if hash wget 2>/dev/null; then
|
||||
set +e
|
||||
command="wget -O- -q $1"
|
||||
wget -O- -q "$1"
|
||||
rc=$?
|
||||
set -e
|
||||
else
|
||||
error "No HTTP download program (curl, wget) found…"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $rc -ne 0 ]; then
|
||||
error "Command failed (exit code $rc): ${BLUE}${command}${NO_COLOR}"
|
||||
exit $rc
|
||||
fi
|
||||
}
|
||||
|
||||
get_latest_release() {
|
||||
fetch "https://api.github.com/repos/iamcco/markdown-preview.nvim/releases/latest" |
|
||||
grep '"tag_name":' |
|
||||
sed -E 's/.*"([^"]+)".*/\1/'
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
info "Fetching latest release."
|
||||
tag=$(get_latest_release)
|
||||
else
|
||||
tag=$1
|
||||
fi
|
||||
|
||||
download() {
|
||||
mkdir -p bin
|
||||
cd bin
|
||||
url="https://github.com/iamcco/markdown-preview.nvim/releases/download/$tag/${1}"
|
||||
info "Downloading binary from ${url}"
|
||||
if fetch "${url}" | tar xzfv -; then
|
||||
chmod a+x ${1%.tar.gz}
|
||||
return
|
||||
else
|
||||
warn "Binary not available for now, please wait for a few minutes."
|
||||
fi
|
||||
}
|
||||
|
||||
arch=$(uname -sm)
|
||||
case "${arch}" in
|
||||
"Linux x86_64") download markdown-preview-linux.tar.gz ;;
|
||||
"Linux i686") download markdown-preview-linux.tar.gz ;;
|
||||
"Darwin x86_64") download markdown-preview-macos.tar.gz ;;
|
||||
"Darwin arm64") download markdown-preview-macos.tar.gz ;;
|
||||
*) info "No pre-built binary available for ${arch}.";;
|
||||
esac
|
1
sources_non_forked/markdown-preview.nvim/app/lib/app/index.d.ts
vendored
Normal file
1
sources_non_forked/markdown-preview.nvim/app/lib/app/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
const load_1 = tslib_1.__importDefault(require("./load"));
|
||||
const PATH = '--path';
|
||||
const VERSION = '--version';
|
||||
const { argv = [] } = process;
|
||||
const param = argv[2];
|
||||
if (param === PATH) {
|
||||
(0, load_1.default)(argv[3]).run();
|
||||
}
|
||||
else if (param === VERSION) {
|
||||
// tslint:disable-next-line
|
||||
console.log('0.0.10');
|
||||
}
|
1
sources_non_forked/markdown-preview.nvim/app/lib/app/load.d.ts
vendored
Normal file
1
sources_non_forked/markdown-preview.nvim/app/lib/app/load.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export default function load(scriptPath: any): any;
|
36
sources_non_forked/markdown-preview.nvim/app/lib/app/load.js
Normal file
36
sources_non_forked/markdown-preview.nvim/app/lib/app/load.js
Normal file
@ -0,0 +1,36 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
const fs_1 = tslib_1.__importDefault(require("fs"));
|
||||
const module_1 = tslib_1.__importDefault(require("module"));
|
||||
const path_1 = tslib_1.__importDefault(require("path"));
|
||||
const vm_1 = tslib_1.__importDefault(require("vm"));
|
||||
const preloadmodules_1 = tslib_1.__importDefault(require("./preloadmodules"));
|
||||
function load(scriptPath) {
|
||||
const userModule = new module_1.default(scriptPath);
|
||||
userModule.filename = scriptPath;
|
||||
userModule.paths = module_1.default._nodeModulePaths(path_1.default.dirname(scriptPath));
|
||||
const moduleCode = fs_1.default.readFileSync(userModule.filename, 'utf-8');
|
||||
userModule.require = userModule.require.bind(userModule);
|
||||
const sanbox = vm_1.default.createContext(Object.assign(Object.assign({}, global), { exports: userModule.exports, module: userModule, require: name => {
|
||||
if (preloadmodules_1.default[name]) {
|
||||
return preloadmodules_1.default[name];
|
||||
}
|
||||
try {
|
||||
return userModule.require(name);
|
||||
}
|
||||
catch (e) {
|
||||
let loadScript = path_1.default.join(path_1.default.dirname(scriptPath), name);
|
||||
if (fs_1.default.existsSync(loadScript) && fs_1.default.statSync(loadScript).isDirectory()) {
|
||||
loadScript = path_1.default.join(loadScript, 'index.js');
|
||||
}
|
||||
else if (!fs_1.default.existsSync(loadScript)) {
|
||||
loadScript = `${loadScript}.js`;
|
||||
}
|
||||
return load(loadScript);
|
||||
}
|
||||
}, __filename: userModule.filename, __dirname: path_1.default.dirname(scriptPath), process }));
|
||||
vm_1.default.runInContext(moduleCode, sanbox, { filename: userModule.filename });
|
||||
return userModule.exports;
|
||||
}
|
||||
exports.default = load;
|
8
sources_non_forked/markdown-preview.nvim/app/lib/app/preloadmodules.d.ts
vendored
Normal file
8
sources_non_forked/markdown-preview.nvim/app/lib/app/preloadmodules.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
declare const _default: {
|
||||
'@chemzqm/neovim': any;
|
||||
log4js: any;
|
||||
tslib: any;
|
||||
'socket.io': any;
|
||||
'msgpack-lite': any;
|
||||
};
|
||||
export default _default;
|
@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const neovim = require('@chemzqm/neovim');
|
||||
const log4js = require('log4js');
|
||||
const tslib = require('tslib');
|
||||
const socketIO = require('socket.io');
|
||||
const msgpackLite = require('msgpack-lite');
|
||||
exports.default = {
|
||||
'@chemzqm/neovim': neovim,
|
||||
log4js,
|
||||
tslib,
|
||||
'socket.io': socketIO,
|
||||
'msgpack-lite': msgpackLite
|
||||
};
|
20
sources_non_forked/markdown-preview.nvim/app/lib/attach/index.d.ts
vendored
Normal file
20
sources_non_forked/markdown-preview.nvim/app/lib/attach/index.d.ts
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
import { Attach, NeovimClient } from '@chemzqm/neovim';
|
||||
interface IApp {
|
||||
refreshPage: ((param: {
|
||||
bufnr: number | string;
|
||||
data: any;
|
||||
}) => void);
|
||||
closePage: ((params: {
|
||||
bufnr: number | string;
|
||||
}) => void);
|
||||
closeAllPages: (() => void);
|
||||
openBrowser: ((params: {
|
||||
bufnr: number | string;
|
||||
}) => void);
|
||||
}
|
||||
interface IPlugin {
|
||||
init: ((app: IApp) => void);
|
||||
nvim: NeovimClient;
|
||||
}
|
||||
export default function (options: Attach): IPlugin;
|
||||
export {};
|
@ -0,0 +1,71 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
const neovim_1 = require("@chemzqm/neovim");
|
||||
const logger = require('../util/logger')('attach'); // tslint:disable-line
|
||||
let app;
|
||||
function default_1(options) {
|
||||
const nvim = (0, neovim_1.attach)(options);
|
||||
nvim.on('notification', (method, args) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
||||
const opts = args[0] || args;
|
||||
const bufnr = opts.bufnr;
|
||||
const buffers = yield nvim.buffers;
|
||||
const buffer = buffers.find(b => b.id === bufnr);
|
||||
if (method === 'refresh_content') {
|
||||
const winline = yield nvim.call('winline');
|
||||
const currentWindow = yield nvim.window;
|
||||
const winheight = yield nvim.call('winheight', currentWindow.id);
|
||||
const cursor = yield nvim.call('getpos', '.');
|
||||
const renderOpts = yield nvim.getVar('mkdp_preview_options');
|
||||
const pageTitle = yield nvim.getVar('mkdp_page_title');
|
||||
const theme = yield nvim.getVar('mkdp_theme');
|
||||
const name = yield buffer.name;
|
||||
const content = yield buffer.getLines();
|
||||
const currentBuffer = yield nvim.buffer;
|
||||
app.refreshPage({
|
||||
bufnr,
|
||||
data: {
|
||||
options: renderOpts,
|
||||
isActive: currentBuffer.id === buffer.id,
|
||||
winline,
|
||||
winheight,
|
||||
cursor,
|
||||
pageTitle,
|
||||
theme,
|
||||
name,
|
||||
content
|
||||
}
|
||||
});
|
||||
}
|
||||
else if (method === 'close_page') {
|
||||
app.closePage({
|
||||
bufnr
|
||||
});
|
||||
}
|
||||
else if (method === 'open_browser') {
|
||||
app.openBrowser({
|
||||
bufnr
|
||||
});
|
||||
}
|
||||
}));
|
||||
nvim.on('request', (method, args, resp) => {
|
||||
if (method === 'close_all_pages') {
|
||||
app.closeAllPages();
|
||||
}
|
||||
resp.send();
|
||||
});
|
||||
nvim.channelId
|
||||
.then((channelId) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
||||
yield nvim.setVar('mkdp_node_channel_id', channelId);
|
||||
}))
|
||||
.catch(e => {
|
||||
logger.error('channelId: ', e);
|
||||
});
|
||||
return {
|
||||
nvim,
|
||||
init: (param) => {
|
||||
app = param;
|
||||
}
|
||||
};
|
||||
}
|
||||
exports.default = default_1;
|
1
sources_non_forked/markdown-preview.nvim/app/lib/util/getIP.d.ts
vendored
Normal file
1
sources_non_forked/markdown-preview.nvim/app/lib/util/getIP.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export declare function getIP(): string;
|
@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getIP = void 0;
|
||||
function getIP() {
|
||||
const interfaces = require('os').networkInterfaces();
|
||||
let IP = '';
|
||||
Object.keys(interfaces).some(devName => {
|
||||
const iface = interfaces[devName];
|
||||
for (const alias of iface) {
|
||||
if (alias.family === 'IPv4' &&
|
||||
alias.address !== '127.0.0.1' &&
|
||||
!alias.internal) {
|
||||
IP = alias.address;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
return IP;
|
||||
}
|
||||
exports.getIP = getIP;
|
1
sources_non_forked/markdown-preview.nvim/app/lib/util/logger.d.ts
vendored
Normal file
1
sources_non_forked/markdown-preview.nvim/app/lib/util/logger.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
const fs_1 = tslib_1.__importDefault(require("fs"));
|
||||
const log4js_1 = tslib_1.__importDefault(require("log4js"));
|
||||
const os_1 = tslib_1.__importDefault(require("os"));
|
||||
const path_1 = tslib_1.__importDefault(require("path"));
|
||||
const MAX_LOG_SIZE = 1024 * 1024;
|
||||
const MAX_LOG_BACKUPS = 10;
|
||||
const LOG_FILE_PATH = process.env.NVIM_MKDP_LOG_FILE || path_1.default.join(os_1.default.tmpdir(), 'mkdp-nvim.log');
|
||||
const level = process.env.NVIM_MKDP_LOG_LEVEL || 'info';
|
||||
if (level === 'debug') {
|
||||
fs_1.default.writeFileSync(LOG_FILE_PATH, '', 'utf8');
|
||||
}
|
||||
const isRoot = process.getuid && process.getuid() === 0;
|
||||
if (!isRoot) {
|
||||
log4js_1.default.configure({
|
||||
appenders: {
|
||||
out: {
|
||||
type: 'file',
|
||||
filename: LOG_FILE_PATH,
|
||||
maxLogSize: MAX_LOG_SIZE,
|
||||
backups: MAX_LOG_BACKUPS,
|
||||
layout: {
|
||||
type: 'pattern',
|
||||
// Format log in following pattern:
|
||||
// yyyy-MM-dd HH:mm:ss.mil $Level (pid:$pid) $categroy - $message.
|
||||
pattern: `%d{yyyy-MM-dd hh:mm:ss} %p (pid:${process.pid}) [%c] - %m`
|
||||
}
|
||||
}
|
||||
},
|
||||
categories: {
|
||||
default: { appenders: ['out'], level }
|
||||
}
|
||||
});
|
||||
}
|
||||
module.exports = (name = 'mkdp') => {
|
||||
return log4js_1.default.getLogger(name);
|
||||
};
|
1
sources_non_forked/markdown-preview.nvim/app/lib/util/opener.d.ts
vendored
Normal file
1
sources_non_forked/markdown-preview.nvim/app/lib/util/opener.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export {};
|
@ -0,0 +1,63 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const tslib_1 = require("tslib");
|
||||
/*
|
||||
* fork from https://github.com/domenic/opener
|
||||
*/
|
||||
const child_process_1 = tslib_1.__importDefault(require("child_process"));
|
||||
const os_1 = tslib_1.__importDefault(require("os"));
|
||||
module.exports = function opener(args, tool) {
|
||||
let platform = process.platform;
|
||||
args = [].concat(args);
|
||||
// Attempt to detect Windows Subystem for Linux (WSL).
|
||||
// WSL itself as Linux (which works in most cases), but in
|
||||
// this specific case we need to treat it as actually being Windows.
|
||||
// The "Windows-way" of opening things through cmd.exe works just fine here,
|
||||
// whereas using xdg-open does not, since there is no X Windows in WSL.
|
||||
if (platform === 'linux' && os_1.default.release().toLowerCase().indexOf('microsoft') !== -1) {
|
||||
platform = 'win32';
|
||||
}
|
||||
// http://stackoverflow.com/q/1480971/3191, but see below for Windows.
|
||||
let command;
|
||||
switch (platform) {
|
||||
case 'win32': {
|
||||
command = 'cmd.exe';
|
||||
if (tool) {
|
||||
args.unshift(tool);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'darwin': {
|
||||
command = 'open';
|
||||
if (tool) {
|
||||
args.unshift(tool);
|
||||
args.unshift('-a');
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
command = tool || 'xdg-open';
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (platform === 'win32') {
|
||||
// On Windows, we really want to use the "start" command.
|
||||
// But, the rules regarding arguments with spaces, and escaping them with quotes,
|
||||
// can get really arcane. So the easiest way to deal with this is to pass off the
|
||||
// responsibility to "cmd /c", which has that logic built in.
|
||||
//
|
||||
// Furthermore, if "cmd /c" double-quoted the first parameter,
|
||||
// then "start" will interpret it as a window title,
|
||||
// so we need to add a dummy empty-string window title: http://stackoverflow.com/a/154090/3191
|
||||
//
|
||||
// Additionally, on Windows ampersand needs to be escaped when passed to "start"
|
||||
args = args.map(value => {
|
||||
return value.replace(/&/g, '^&');
|
||||
});
|
||||
args = ['/c', 'start', '""'].concat(args);
|
||||
}
|
||||
return child_process_1.default.spawn(command, args, {
|
||||
shell: false,
|
||||
detached: true
|
||||
});
|
||||
};
|
11
sources_non_forked/markdown-preview.nvim/app/next.config.js
Normal file
11
sources_non_forked/markdown-preview.nvim/app/next.config.js
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
module.exports = {
|
||||
pageExtensions: [ 'jsx' ],
|
||||
exportPathMap: async function () {
|
||||
return {
|
||||
'/': { page: '/' },
|
||||
'/404.html': { page: '/404' }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user