From 9e9f552f22d8ab945554303341e0ece5c37beaad Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Tue, 14 Sep 2021 13:24:41 +0300 Subject: [PATCH] Add wagtailmarkdown. Fixes #123. --- ietf/settings/base.py | 5 +++++ ietf/utils/blocks.py | 2 ++ package.json | 3 ++- requirements.txt | 2 ++ yarn.lock | 5 +++++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ietf/settings/base.py b/ietf/settings/base.py index a4ec7a06..18ba7ea0 100644 --- a/ietf/settings/base.py +++ b/ietf/settings/base.py @@ -71,6 +71,7 @@ "django.contrib.admindocs", "mod_wsgi.server", "analytical", + "wagtailmarkdown", ) MIDDLEWARE = [ @@ -175,6 +176,10 @@ } +WAGTAILMARKDOWN = { + "autodownload_fontawesome": True, +} + # Wagtail settings WAGTAIL_SITE_NAME = "ietf" diff --git a/ietf/utils/blocks.py b/ietf/utils/blocks.py index a9b010e2..f5acc325 100644 --- a/ietf/utils/blocks.py +++ b/ietf/utils/blocks.py @@ -4,12 +4,14 @@ from wagtail.contrib.table_block.blocks import TableBlock from wagtail.images.blocks import ImageChooserBlock from wagtail.embeds.blocks import EmbedBlock +from wagtailmarkdown.blocks import MarkdownBlock class StandardBlock(StreamBlock): heading = CharBlock(icon="title") paragraph = RichTextBlock(icon="pilcrow") image = ImageChooserBlock(icon="image", template='includes/imageblock.html') + markdown = MarkdownBlock(icon="code") embed = EmbedBlock(icon="code") raw_html = RawHTMLBlock(icon="placeholder") table = TableBlock(table_options={'renderer': 'html'}, template="includes/tableblock.html") diff --git a/package.json b/package.json index cf47170f..c6e1eeb5 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "dependencies": { "@axe-core/puppeteer": "^4.2.2", "@buzuli/json": "^2.1.0", + "@fortawesome/fontawesome-free": "^5.15.4", "autoprefixer": "^10.2.6", "babel-loader": "^8.2.2", "bootstrap": "^4.6.0", @@ -50,11 +51,11 @@ "ionicons": "^2", "jquery": "^3.6.0", "jquery-ui": "^1.12.1", - "sass": "^1.35.1", "normalize.css": "^8.0.1", "popper.js": "^1.16.1-LTS", "postcss-normalize": "^10.0.0", "puppeteer": "^10.1.0", + "sass": "^1.35.1", "ts-node": "^10.0.0", "typescript": "^4.3.4" } diff --git a/requirements.txt b/requirements.txt index 18b90426..b0023720 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,6 +12,8 @@ django_compressor>=2.2 mod_wsgi>=4.6 django_analytical>=2.5 tqdm>=3.7.0 +wagtail-markdown +Pygments # env var configuration typed-environment-configuration>=0.1.3,<0.2 diff --git a/yarn.lock b/yarn.lock index 960b45da..cdc97dce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -947,6 +947,11 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" +"@fortawesome/fontawesome-free@^5.15.4": + version "5.15.4" + resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.15.4.tgz#ecda5712b61ac852c760d8b3c79c96adca5554e5" + integrity sha512-eYm8vijH/hpzr/6/1CJ/V/Eb1xQFW2nnUKArb3z+yUWv7HTwj6M7SP957oMjfZjAHU6qpoNc2wQvIxBLWYa/Jg== + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"