Skip to content

Commit

Permalink
Merge pull request #7855 from jbudz/bump-marked
Browse files Browse the repository at this point in the history
Bump marked dependency
  • Loading branch information
epixa authored Jul 27, 2016
2 parents 4f6b7d4 + 7cf64c7 commit da1187f
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 40 deletions.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"angular-bootstrap-colorpicker": "3.0.19",
"angular-elastic": "2.5.0",
"angular-route": "1.4.7",
"angular-sanitize": "1.5.7",
"ansicolors": "0.3.2",
"autoprefixer": "5.1.1",
"autoprefixer-loader": "2.0.0",
Expand Down Expand Up @@ -127,7 +128,7 @@
"less": "2.5.1",
"less-loader": "2.2.0",
"lodash": "3.10.1",
"marked": "0.3.3",
"marked": "0.3.5",
"minimatch": "2.0.10",
"mkdirp": "0.5.1",
"moment": "2.13.0",
Expand Down Expand Up @@ -178,7 +179,6 @@
"grunt-simple-mocha": "0.4.0",
"gruntify-eslint": "1.0.1",
"handlebars": "4.0.5",
"html-entities": "1.1.3",
"husky": "0.8.1",
"image-diff": "1.6.0",
"intern": "3.2.3",
Expand All @@ -193,7 +193,6 @@
"license-checker": "3.1.0",
"load-grunt-config": "0.19.1",
"makelogs": "3.0.2",
"marked-text-renderer": "0.1.0",
"mocha": "2.3.0",
"ncp": "2.0.0",
"nock": "2.10.0",
Expand Down
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);
});
});
2 changes: 1 addition & 1 deletion src/ui/public/directives/partials/truncated.html
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>
5 changes: 3 additions & 2 deletions src/ui/public/directives/truncated.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import truncText from 'trunc-text';
import truncHTML from 'trunc-html';
import uiModules from 'ui/modules';
import truncatedTemplate from 'ui/directives/partials/truncated.html';
import 'ui/filters/trust_as_html';
const module = uiModules.get('kibana');
import 'angular-sanitize';

const module = uiModules.get('kibana', ['ngSanitize']);

module.directive('kbnTruncated', function ($compile) {
return {
Expand Down
7 changes: 4 additions & 3 deletions src/ui/public/filters/markdown.js
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)) : '';
});
4 changes: 2 additions & 2 deletions src/ui/public/vislib/visualizations/_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import VislibVisualizationsMarkerTypesScaledCirclesProvider from 'ui/vislib/visu
import VislibVisualizationsMarkerTypesShadedCirclesProvider from 'ui/vislib/visualizations/marker_types/shaded_circles';
import VislibVisualizationsMarkerTypesGeohashGridProvider from 'ui/vislib/visualizations/marker_types/geohash_grid';
import VislibVisualizationsMarkerTypesHeatmapProvider from 'ui/vislib/visualizations/marker_types/heatmap';
export default function MapFactory(Private, tilemap) {
export default function MapFactory(Private, tilemap, $sanitize) {

let defaultMapZoom = 2;
let defaultMapCenter = [15, 5];
let defaultMarkerType = 'Scaled Circle Markers';

let tilemapOptions = tilemap.options;
let attribution = marked(tilemapOptions.attribution);
let attribution = $sanitize(marked(tilemapOptions.attribution));

let mapTiles = {
url: tilemap.url,
Expand Down
4 changes: 3 additions & 1 deletion src/ui/public/visualize/visualize.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ import _ from 'lodash';
import RegistryVisTypesProvider from 'ui/registry/vis_types';
import uiModules from 'ui/modules';
import visualizeTemplate from 'ui/visualize/visualize.html';
import 'angular-sanitize';

uiModules
.get('kibana/directive')
.get('kibana/directive', ['ngSanitize'])
.directive('visualize', function (Notifier, SavedVis, indexPatterns, Private, config, $timeout) {


Expand Down
30 changes: 5 additions & 25 deletions tasks/build/readme.js
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')));
});

};

0 comments on commit da1187f

Please sign in to comment.