Browse Source

Update project structure

simov 9 years ago
parent
commit
552033301b

+ 10 - 0
.editorconfig

@@ -0,0 +1,10 @@
+# editorconfig.org
+root = true
+
+[*]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true

+ 0 - 0
css/mdviewer.css → css/options.css


+ 1 - 1
chrome/background.js → js/background/background.js

@@ -21,7 +21,7 @@ chrome.extension.onMessage.addListener(function (req, sender, sendResponse) {
     case 'markdown':
     case 'markdown':
       md.compile(req.markdown, sendResponse)
       md.compile(req.markdown, sendResponse)
       break
       break
-    
+
     case 'settings':
     case 'settings':
       chrome.storage.sync.get(['options', 'theme', 'raw'], function (data) {
       chrome.storage.sync.get(['options', 'theme', 'raw'], function (data) {
         delete data.options.langPrefix
         delete data.options.langPrefix

+ 1 - 1
chrome/markdown.js → js/background/markdown.js

@@ -22,7 +22,7 @@ var md = (function () {
         // prism fix
         // prism fix
         html = html.replace(/language-html/g, 'language-markup')
         html = html.replace(/language-html/g, 'language-markup')
         html = html.replace(/language-js/g, 'language-javascript')
         html = html.replace(/language-js/g, 'language-javascript')
-        
+
         sendResponse({message: 'marked', marked: html})
         sendResponse({message: 'marked', marked: html})
       })
       })
     })
     })

+ 3 - 3
js/content.js

@@ -10,7 +10,7 @@ function injectCSS () {
 
 
 $(function () {
 $(function () {
   injectCSS()
   injectCSS()
-  
+
   $('body').addClass('markdown-body')//github
   $('body').addClass('markdown-body')//github
   $('pre').attr('id', 'markdown').hide()
   $('pre').attr('id', 'markdown').hide()
 
 
@@ -26,7 +26,7 @@ $(function () {
     message: 'settings',
     message: 'settings',
   }, function (data) {
   }, function (data) {
     $('#theme').attr('href', chrome.extension.getURL('/themes/'+data.theme+'.css'))
     $('#theme').attr('href', chrome.extension.getURL('/themes/'+data.theme+'.css'))
-    
+
     $('#theme').attr('disabled', data.raw)
     $('#theme').attr('disabled', data.raw)
     $('#markdown')[data.raw?'show':'hide']()
     $('#markdown')[data.raw?'show':'hide']()
     $('#html')[data.raw?'hide':'show']()
     $('#html')[data.raw?'hide':'show']()
@@ -52,7 +52,7 @@ chrome.extension.onMessage.addListener(function (req, sender, sendResponse) {
     case 'reload':
     case 'reload':
       window.location.reload(true)
       window.location.reload(true)
       break
       break
-    
+
     case 'theme':
     case 'theme':
       var raw = $('#theme').attr('disabled') == 'disabled'
       var raw = $('#theme').attr('disabled') == 'disabled'
       $('#theme').remove()
       $('#theme').remove()

+ 4 - 4
js/mdviewer.js → js/options.js

@@ -27,7 +27,7 @@ mdviewer.controller('popup', ['$scope', function ($scope) {
       message: 'settings'
       message: 'settings'
     }, function (res) {
     }, function (res) {
       $scope.options = toArray(res.options, 'name', 'enabled')
       $scope.options = toArray(res.options, 'name', 'enabled')
-      
+
       $scope.themes = chrome.runtime.getManifest().web_accessible_resources
       $scope.themes = chrome.runtime.getManifest().web_accessible_resources
         .filter(function (file) {return file.indexOf('/themes/') == 0})
         .filter(function (file) {return file.indexOf('/themes/') == 0})
         .map(function (file) {
         .map(function (file) {
@@ -41,13 +41,13 @@ mdviewer.controller('popup', ['$scope', function ($scope) {
     })
     })
   }
   }
   init()
   init()
-  
+
   $scope.onOptions = function () {
   $scope.onOptions = function () {
     chrome.extension.sendMessage({
     chrome.extension.sendMessage({
       message: 'options',
       message: 'options',
       options: toObject(JSON.parse(angular.toJson($scope.options)), 'name', 'enabled')
       options: toObject(JSON.parse(angular.toJson($scope.options)), 'name', 'enabled')
     }, function (res) {
     }, function (res) {
-      
+
     })
     })
   }
   }
   $scope.onTheme = function () {
   $scope.onTheme = function () {
@@ -64,7 +64,7 @@ mdviewer.controller('popup', ['$scope', function ($scope) {
       message: 'raw',
       message: 'raw',
       raw: $scope.raw
       raw: $scope.raw
     }, function (res) {
     }, function (res) {
-      
+
     })
     })
   }
   }
   $scope.onDefaults = function () {
   $scope.onDefaults = function () {

+ 0 - 0
jslib/angular.min.js → js/vendor/angular.min.js


+ 0 - 0
jslib/jquery-2.0.3.min.js → js/vendor/jquery-2.0.3.min.js


+ 0 - 0
jslib/jquery-2.0.3.min.map → js/vendor/jquery-2.0.3.min.map


+ 0 - 0
jslib/marked.js → js/vendor/marked.js


+ 0 - 0
jslib/prism.js → js/vendor/prism.js


+ 9 - 9
manifest.json

@@ -10,14 +10,14 @@
       "38" : "/images/icon38.png"
       "38" : "/images/icon38.png"
     },
     },
     "default_title": "Markdown Viewer",
     "default_title": "Markdown Viewer",
-    "default_popup": "/views/popup.html"
+    "default_popup": "/views/options.html"
   },
   },
-  
+
   "background" : {
   "background" : {
     "scripts": [
     "scripts": [
-      "/jslib/marked.js",
-      "/chrome/markdown.js",
-      "/chrome/background.js"
+      "/js/vendor/marked.js",
+      "/js/background/markdown.js",
+      "/js/background/background.js"
     ],
     ],
     "persistent": false
     "persistent": false
   },
   },
@@ -53,8 +53,8 @@
         "/css/prism.css"
         "/css/prism.css"
       ],
       ],
       "js": [
       "js": [
-        "/jslib/jquery-2.0.3.min.js",
-        "/jslib/prism.js",
+        "/js/vendor/jquery-2.0.3.min.js",
+        "/js/vendor/prism.js",
         "/js/content.js"
         "/js/content.js"
       ],
       ],
       "run_at": "document_start",
       "run_at": "document_start",
@@ -63,10 +63,10 @@
   ],
   ],
 
 
   "web_accessible_resources": [
   "web_accessible_resources": [
-    "/jslib/jquery-2.0.3.min.map",
+    "/js/vendor/jquery-2.0.3.min.map",
 
 
     "/themes/github.css",
     "/themes/github.css",
-     
+
     "/themes/avenir-white.css",
     "/themes/avenir-white.css",
     "/themes/foghorn.css",
     "/themes/foghorn.css",
     "/themes/jasonm23-dark.css",
     "/themes/jasonm23-dark.css",

+ 258 - 0
syntax.md

@@ -0,0 +1,258 @@
+
+h1
+===
+
+# h1
+
+## h2
+
+### h3
+
+#### h4
+
+##### h5
+
+###### h6
+
+#h1
+
+##h2
+
+###h3
+
+####h4
+
+#####h5
+
+######h6
+
+---
+
+- ul
+  - ul
+    - ul
+
+1. ol
+  1. ol
+    1. ol
+
+**bold**
+
+*italic*
+
+_italic_
+
+[link with inline URL](https://github.com/simov/markdown-viewer)
+
+[link index][1]
+
+[named link][some-url]
+
+![image][2]
+
+[![image link][2]][some-url]
+
+`inline code`
+
+<kbd>keyboard keys like Ctrl+P</kbd>
+
+<[email protected]>
+
+> blockquote
+
+~~line through~~
+
+table    | col          | col   | col
+---      | :---         | :---: | ---:
+defaults | left aligned | centered | right aligned
+
+<div style="text-align: center">
+  <p><strong>HTML</strong> tags</p>
+</div>
+
+
+```
+fenced code block
+```
+
+    code block using
+    indentation
+
+---
+
+```actionscript
+var some = new actionscript();
+```
+
+```apacheconf
+ServerName apacheconf
+```
+
+```aspnet
+<asp:Label runat="server" id="aspnet"></asp:Label>
+```
+
+```bash
+$some = "bash";
+```
+
+```basic
+Dim basic As Integer
+```
+
+```batch
+set some="batch"
+```
+
+```c
+char some = "c";
+```
+
+```coffeescript
+some = "coffeescript"
+```
+
+```cpp
+char some = "cpp";
+```
+
+```csharp
+string some = "csharp";
+```
+
+```css
+#some { content: 'css'; }
+```
+
+```dart
+var some = "dart";
+```
+
+```docker
+MAINTAINER docker
+```
+
+```erlang
+module(erlang)
+```
+
+```go
+type go string
+```
+
+```haskell
+haskell :: Str -> String
+```
+
+```html
+<p id="some">html</p>
+```
+
+```java
+public static final void main java();
+```
+
+```javascript
+let some = 'javascript';
+```
+
+```js
+const some = 'js';
+```
+
+```json
+{"some": "json"}
+```
+
+```jsonp
+function({"some": "jsonp"})
+```
+
+```lua
+local some = "lua"
+```
+
+```makefile
+check: makefile
+```
+
+```markdown
+`some` **markdown**
+```
+
+```markup
+<p>some <strong>markup</strong></p>
+```
+
+```nginx
+server_name nginx;
+```
+
+```objectivec
+char some = "objectivec";
+```
+
+```perl
+$some = "perl";
+```
+
+```php
+$some = "php";
+```
+
+```prolog
+some('prolog', 1972)
+```
+
+```python
+some = 'python'
+```
+
+```ruby
+some = "ruby"
+```
+
+```rust
+let some = 'rust';
+```
+
+```sass
+@include sass;
+```
+
+```scheme
+(define some 'scheme')
+```
+
+```scss
+@include scss;
+```
+
+```smalltalk
+'some smalltalk'
+```
+
+```sql
+select * from `language` where `name` = 'sql';
+```
+
+```swift
+var some = "swift"
+```
+
+```typescript
+var some: string = "typescript";
+```
+
+```xml
+<some name="xml"></some>
+```
+
+```yaml
+- language: yaml
+```
+
+
+  [1]: https://github.com/simov/markdown-viewer
+  [2]: http://i.imgur.com/rKYxW.jpg (Image Title)
+  [some-url]: https://github.com/simov/markdown-viewer

+ 7 - 7
views/popup.html → views/options.html

@@ -4,16 +4,16 @@
   <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
   <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
   <title>Markdown Viewer</title>
   <title>Markdown Viewer</title>
 
 
-  <link href="/css/mdviewer.css" rel="stylesheet" type="text/css" media="all" />
+  <link href="/css/options.css" rel="stylesheet" type="text/css" media="all" />
 
 
-  <script src="/jslib/angular.min.js" type="text/javascript" charset="utf-8"></script>
-  <script src="/js/mdviewer.js" type="text/javascript" charset="utf-8"></script>
+  <script src="/js/vendor/angular.min.js" type="text/javascript" charset="utf-8"></script>
+  <script src="/js/options.js" type="text/javascript" charset="utf-8"></script>
 </head>
 </head>
 <body ng-controller="popup">
 <body ng-controller="popup">
-  
+
   <a href="" ng-click="onRaw()">{{raw ? 'Html' : 'Markdown'}}</a>
   <a href="" ng-click="onRaw()">{{raw ? 'Html' : 'Markdown'}}</a>
   <a href="" ng-click="onDefaults()">Defaults</a>
   <a href="" ng-click="onDefaults()">Defaults</a>
-  
+
   <h4>Theme</h4>
   <h4>Theme</h4>
   <select
   <select
     ng-model="theme"
     ng-model="theme"
@@ -28,9 +28,9 @@
         <input type="checkbox" ng-model="option.enabled" ng-change="onOptions()" />
         <input type="checkbox" ng-model="option.enabled" ng-change="onOptions()" />
         {{option.name}}
         {{option.name}}
       </label>
       </label>
-      
+
     </li>
     </li>
   </ul>
   </ul>
 
 
 </body>
 </body>
-</html>
+</html>