How to use the wagtailcodeblock.blocks.CodeBlock function in wagtailcodeblock

To help you get started, we’ve selected a few wagtailcodeblock examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FlipperPA / wagtailcontentstream / wagtailcontentstream / blocks.py View on Github external
paragraph = RichTextBlock(
        icon='pilcrow',
        features=['bold', 'italic', 'link', 'ol', 'ul', 'monospace'],
    )
    image = CaptionedImageBlock()
    document = DocumentChooserBlock()
    embed = EmbedBlock(icon='media')
    table = TableBlock(icon='table')
    code = CodeBlock(icon='code')

    class Meta:
        help_text = 'The main page body.'


class ContentStreamBlockWithRawCode(ContentStreamBlock):
    raw_code = CodeBlock(
        icon='code',
        language='html',
        template='wagtailcodeblock/raw_code.html',
    )


class SectionStructBlock(StructBlock):
    """
    Contains the elements we'll want to have in a Sectioned Content Stream block.
    """
    section_heading = TextBlock(
        icon='title',
        help_text='Heading for this section.',
    )
    body = ContentStreamBlock(
        help_text='The body content goes here.',
github FlipperPA / wagtailcontentstream / wagtailcontentstream / blocks.py View on Github external
"""
    Contains the elements we'll want to have in a Content Stream.
    """
    heading = TextBlock(
        icon='title',
        template='wagtailcontentstream/blocks/heading.html',
    )
    paragraph = RichTextBlock(
        icon='pilcrow',
        features=['bold', 'italic', 'link', 'ol', 'ul', 'monospace'],
    )
    image = CaptionedImageBlock()
    document = DocumentChooserBlock()
    embed = EmbedBlock(icon='media')
    table = TableBlock(icon='table')
    code = CodeBlock(icon='code')

    class Meta:
        help_text = 'The main page body.'


class ContentStreamBlockWithRawCode(ContentStreamBlock):
    raw_code = CodeBlock(
        icon='code',
        language='html',
        template='wagtailcodeblock/raw_code.html',
    )


class SectionStructBlock(StructBlock):
    """
    Contains the elements we'll want to have in a Sectioned Content Stream block.
github FlipperPA / wagtailcontentstream / wagtailcontentstream / __init__.py View on Github external
)
from wagtail.wagtailcore.blocks import StreamBlock
from wagtail.wagtailembeds.blocks import EmbedBlock
from wagtail.contrib.table_block.blocks import TableBlock
from wagtailcodeblock.blocks import CodeBlock

from .blocks import CaptionedImageBlock


class ContentStream(StreamBlock):
    paragraph = RichTextBlock(icon='fa-paragraph')
    heading = TextBlock(icon='fa-header', template='wagtailcontentstream/blocks/heading.html')
    image = CaptionedImageBlock()
    table = TableBlock(icon='fa-table')
    embed = EmbedBlock(icon='fa-youtube-play')
    code = CodeBlock(label='Code snippet')

    class Meta:
        template = 'standard/blocks/streamfield.html'

wagtailcodeblock

Wagtail Code Block provides PrismJS syntax highlighting in Wagtail.

BSD-3-Clause
Latest version published 10 months ago

Package Health Score

59 / 100
Full package analysis

Popular wagtailcodeblock functions

Similar packages