From 7dd5fe440c998a1df684972f7f83103cb02cca38 Mon Sep 17 00:00:00 2001 From: evilz Date: Sat, 21 Sep 2019 22:28:41 +0200 Subject: [PATCH] Fix with @evilz/markdown-it-attrs --- README.md | 2 +- package-lock.json | 24 ++++++++++++------------ package.json | 6 +++--- src/Container.ts | 1 + src/Markdown-it.ts | 2 +- src/RevealServer.ts | 13 ++++--------- 6 files changed, 22 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index a160bbcb..c1448582 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# vscode-reveal [![](https://img.shields.io/badge/Version-3.4-blue.svg)](https://marketplace.visualstudio.com/items?itemName=evilz.vscode-reveal) +# vscode-reveal [![](https://img.shields.io/badge/Version-4.0.1-blue.svg)](https://marketplace.visualstudio.com/items?itemName=evilz.vscode-reveal) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=evilz_vscode-reveal&metric=alert_status)](https://sonarcloud.io/dashboard?id=evilz_vscode-reveal) [![Azure Pipeline](https://evilz.visualstudio.com/vscode-reveal/_apis/build/status/2)](https://evilz.visualstudio.com/vscode-reveal/_build?definitionId=2) diff --git a/package-lock.json b/package-lock.json index b1f8fbfd..3152bd96 100644 --- a/package-lock.json +++ b/package-lock.json @@ -217,6 +217,11 @@ "minimist": "^1.2.0" } }, + "@evilz/markdown-it-attrs": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@evilz/markdown-it-attrs/-/markdown-it-attrs-3.0.1.tgz", + "integrity": "sha512-0YNxi8IOR1yTmPFiuqADgDmW877AYNQK7a9H5HcBkcOQ5TnrNLkMk+qtlFFTqD4S3U5dz44g59+Nj2ZqwwlFtg==" + }, "@jest/console": { "version": "24.9.0", "resolved": "https://registry.npmjs.org/@jest/console/-/console-24.9.0.tgz", @@ -2695,9 +2700,9 @@ } }, "entities": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.2.tgz", - "integrity": "sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w==" + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-2.0.0.tgz", + "integrity": "sha512-D9f7V0JSRwIxlRI2mjMqufDrRDnx8p+eEOz7aUM9SuvF8gsBzra0/6tbjl1m8eQHrZlYj6PxqE00hZ1SAIKPLw==" }, "errno": { "version": "0.1.7", @@ -5696,22 +5701,17 @@ } }, "markdown-it": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-9.0.0.tgz", - "integrity": "sha512-bUVTYGt/K/mYr3HlE+PBe6TOTyWghcpSZqOD9t+NFRlwJMhp9Kp6WQ8fJ26I6v1Xo71UmPYt1S4Hc9Lq8GZx2Q==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-10.0.0.tgz", + "integrity": "sha512-YWOP1j7UbDNz+TumYP1kpwnP0aEa711cJjrAQrzd0UXlbJfc5aAq0F/PZHjiioqDC1NKgvIMX+o+9Bk7yuM2dg==", "requires": { "argparse": "^1.0.7", - "entities": "~1.1.1", + "entities": "~2.0.0", "linkify-it": "^2.0.0", "mdurl": "^1.0.1", "uc.micro": "^1.0.5" } }, - "markdown-it-attrs": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/markdown-it-attrs/-/markdown-it-attrs-3.0.1.tgz", - "integrity": "sha512-fcpdmxdEsctDVJEunPyrirVtU/6zcTMxPxAu4Ofz51PKAa8vRMpmGQXsmXx1HTdIdUPoDonm/RhS/+jTNywj/Q==" - }, "markdown-it-block-embed": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/markdown-it-block-embed/-/markdown-it-block-embed-0.0.3.tgz", diff --git a/package.json b/package.json index 4213f168..209cbf04 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "vscode-reveal", "displayName": "vscode-reveal", "description": "Show markdown as revealJs presentation", - "version": "4.0.0", + "version": "4.0.1", "publisher": "evilz", "author": "Vincent Bourdon", "license": "MIT", @@ -369,6 +369,7 @@ "all": true }, "dependencies": { + "@evilz/markdown-it-attrs": "^3.0.1", "fs-jetpack": "^2.2.2", "gray-matter": "^4.0.2", "koa": "^2.8.1", @@ -376,8 +377,7 @@ "koa-logger": "^3.2.1", "koa-router": "^7.4.0", "koa-static": "^5.0.0", - "markdown-it": "^9.0.0", - "markdown-it-attrs": "^3.0.1", + "markdown-it": "^10.0.0", "markdown-it-block-embed": "0.0.3", "markdown-it-container": "^2.0.0", "markdown-it-github-headings": "^1.1.1", diff --git a/src/Container.ts b/src/Container.ts index 1b0cad6c..c562d3d0 100644 --- a/src/Container.ts +++ b/src/Container.ts @@ -89,6 +89,7 @@ export default class Container { this.editorContext = null this.server = new RevealServer( + this.logger, () => this.rootDir, () => this.slides, () => this.configuration, diff --git a/src/Markdown-it.ts b/src/Markdown-it.ts index 7100c101..9f51f957 100644 --- a/src/Markdown-it.ts +++ b/src/Markdown-it.ts @@ -1,6 +1,6 @@ -import * as attrs from 'markdown-it-attrs' +import * as attrs from '@evilz/markdown-it-attrs' import * as blockEmbed from 'markdown-it-block-embed' import * as container from 'markdown-it-container' import * as githubHeadings from 'markdown-it-github-headings' diff --git a/src/RevealServer.ts b/src/RevealServer.ts index bcdc4766..a745bc0f 100644 --- a/src/RevealServer.ts +++ b/src/RevealServer.ts @@ -11,6 +11,7 @@ import markdown from './Markdown-it' import { Configuration } from './Configuration' import { exportHTML, IExportOptions } from "./ExportHTML"; import { ISlide } from './ISlide'; +import { Logger } from './Logger' @@ -20,6 +21,7 @@ export class RevealServer { private readonly host = 'localhost' constructor( + private readonly logger: Logger, private readonly getRootDir: () => string, private readonly getSlides: () => ISlide[], private readonly getConfiguration: () => Configuration, @@ -63,7 +65,7 @@ export class RevealServer { const app = this.app // LOG REQUEST - app.use(koalogger()) + app.use(koalogger((str, args) => {this.logger.log(str)})) app.use(this.exportMiddleware(exportHTML, () => this.isInExport())) // For static media or else @@ -98,17 +100,10 @@ export class RevealServer { const libsPAth = path.join(this.extensionPath, 'libs') router.get('/libs', koastatic(libsPAth)); - // TODO : make middleware - // this.app.get('/markdown.md', (req, res) => { - // res.send(this.getSlideContent()) - // }) - app.use(router.routes()); - // Error Handling app.on('error', err => { - // todo use logger - console.error('server error', err) + this.logger.error(err) }) this.server = app.listen();