From 3072eb28c201dd0242e1aa6ffca2fff8eddf274f Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Thu, 1 Aug 2019 18:33:10 +0200 Subject: [PATCH] Support and render Markdown in model meta [ci skip] --- website/src/templates/models.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/website/src/templates/models.js b/website/src/templates/models.js index b9cd81c97..4713f4b34 100644 --- a/website/src/templates/models.js +++ b/website/src/templates/models.js @@ -14,7 +14,7 @@ import Icon from '../components/icon' import Link from '../components/link' import Grid from '../components/grid' import Infobox from '../components/infobox' -import { join, arrayToObj, abbrNum } from '../components/util' +import { join, arrayToObj, abbrNum, markdownToReact } from '../components/util' const MODEL_META = { core: 'Vocabulary, syntax, entities, vectors', @@ -43,6 +43,10 @@ const MODEL_META = { compat: 'Latest compatible model version for your spaCy installation', } +const MARKDOWN_COMPONENTS = { + code: InlineCode, +} + function getModelComponents(name) { const [lang, type, genre, size] = name.split('_') return { lang, type, genre, size } @@ -192,10 +196,8 @@ const Model = ({ name, langId, langName, baseUrl, repo, compatibility, hasExampl python -m spacy download {name} - {meta.description &&

{meta.description}

} - + {meta.description && markdownToReact(meta.description, MARKDOWN_COMPONENTS)} {isError && error} - {rows.map(({ label, tag, help, content }, i) => @@ -243,7 +245,7 @@ const Model = ({ name, langId, langName, baseUrl, repo, compatibility, hasExampl ) )} - {meta.notes &&

{meta.notes}

} + {meta.notes && markdownToReact(meta.notes, MARKDOWN_COMPONENTS)} {hasInteractiveCode && ( {[