Automatically attach library when <code> tag detected

Created on 30 July 2023, over 1 year ago
Updated 2 August 2023, over 1 year ago

Problem/Motivation

When always_include_prism_library is off, when the filter plugin detect a [prism] tag it transforms it into <pre><code>, however if there are other existing <pre><code> tags, they are transformed into prism since the library is added. However if there is no [prism] tag, the existing <pre>code> tags are not transformed by prism because the library is not added.

We should make the behaviour consistent by also detecting <code> and automatically adding the library.

Obviously, when always_include_prism_library is on, both <code> and [prism] are always transformed.

Steps to reproduce

always_include_prism_library = off.

Add a <pre><code>, notice it is not tranformed.

Add a [prism] anywhere else in the same request, notice both the [prism] and <pre><code> are transformed.

Proposed resolution

Add library when <code> is detected.

This will also allow code fences ``` from markdown to tranform to <code> and add the library, without needing to always add the library ( w/ always_include_prism_library = on).

Remaining tasks

Implement

User interface changes

Nil

API changes

Nil, automatic and non-configurable.

Data model changes

Nil

✨ Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡¦πŸ‡ΊAustralia dpi Perth, Australia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024