-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7855 from jbudz/bump-marked
Bump marked dependency
- Loading branch information
Showing
8 changed files
with
26 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
9 changes: 6 additions & 3 deletions
9
src/core_plugins/markdown_vis/public/markdown_vis_controller.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
import marked from 'marked'; | ||
import uiModules from 'ui/modules'; | ||
import 'angular-sanitize'; | ||
|
||
marked.setOptions({ | ||
gfm: true, // Github-flavored markdown | ||
sanitize: true // Sanitize HTML tags | ||
}); | ||
|
||
const module = uiModules.get('kibana/markdown_vis', ['kibana']); | ||
module.controller('KbnMarkdownVisController', function ($scope, $sce) { | ||
|
||
const module = uiModules.get('kibana/markdown_vis', ['kibana', 'ngSanitize']); | ||
module.controller('KbnMarkdownVisController', function ($scope) { | ||
$scope.$watch('vis.params.markdown', function (html) { | ||
if (!html) return; | ||
$scope.html = $sce.trustAsHtml(marked(html)); | ||
$scope.html = marked(html); | ||
}); | ||
}); |
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,5 +1,5 @@ | ||
<span ng-if="!isHtml">{{content}}</span> | ||
<span ng-if="isHtml" ng-bind-html="content | trustAsHtml"></span> | ||
<span ng-if="isHtml" ng-bind-html="content"></span> | ||
<span ng-if="truncated"> | ||
<a ng-click="toggle()">{{action}}</a> | ||
</span> |
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,13 +1,14 @@ | ||
import marked from 'marked'; | ||
import uiModules from 'ui/modules'; | ||
import 'angular-sanitize'; | ||
|
||
marked.setOptions({ | ||
gfm: true, // GitHub-flavored markdown | ||
sanitize: true // Sanitize HTML tags | ||
}); | ||
|
||
uiModules | ||
.get('kibana') | ||
.filter('markdown', function ($sce) { | ||
return md => md ? $sce.trustAsHtml(marked(md)) : ''; | ||
.get('kibana', ['ngSanitize']) | ||
.filter('markdown', function ($sanitize) { | ||
return md => md ? $sanitize(marked(md)) : ''; | ||
}); |
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,37 +1,17 @@ | ||
let marked = require('marked'); | ||
let Promise = require('bluebird'); | ||
let { join } = require('path'); | ||
let TextRenderer = require('marked-text-renderer'); | ||
let _ = require('lodash'); | ||
let fs = require('fs'); | ||
let { AllHtmlEntities } = require('html-entities'); | ||
let entities = new AllHtmlEntities(); | ||
|
||
TextRenderer.prototype.heading = function (text, level, raw) { | ||
return '\n\n' + text + '\n' + _.map(text, function () { return '='; }).join('') + '\n'; | ||
}; | ||
|
||
module.exports = function (grunt) { | ||
|
||
grunt.registerTask('_build:readme', function () { | ||
let transform = function (input) { | ||
let output = input.replace(/<\!\-\- [^\-]+ \-\->/g, '\n'); | ||
output = marked(output); | ||
return entities.decode(output); | ||
}; | ||
|
||
marked.setOptions({ | ||
renderer: new TextRenderer(), | ||
tables: true, | ||
breaks: false, | ||
pedantic: false, | ||
sanitize: false, | ||
smartLists: true, | ||
smartypants: false | ||
}); | ||
function transformReadme(readme) { | ||
return readme.replace(/\s##\sSnapshot\sBuilds[\s\S]*/, ''); | ||
} | ||
|
||
grunt.file.write('build/kibana/README.txt', transform(grunt.file.read('README.md'))); | ||
grunt.file.write('build/kibana/LICENSE.txt', transform(grunt.file.read('LICENSE.md'))); | ||
grunt.file.copy('LICENSE.md', 'build/kibana/LICENSE.txt'); | ||
grunt.file.write('build/kibana/README.txt', transformReadme(grunt.file.read('README.md'))); | ||
}); | ||
|
||
}; |