Skip to main content

Python Vuetify Markdown

This is an extension for Python-Markdown created for those who combine Python, Markdown, Vue, and Vuetify. I've been using this combination in several projects, and finally came across a need to process Markdown code, and keep it styled with Vuetify. Rather than McGuyver some solution in, I settled on a simple extension to do the heavy lifting.

The code is dead simple, and can be modified or extended to fit your needs.

Installation

pip install PythonVuetifyMarkdown

Usage

Here's a quick example of usage within a Django project. We have a Page model for custom pages, and a function to return the content parsed through Markdown.

from django.db import models
from django.utils.html import mark_safe
import markdown
from python_vuetify_markdown import PythonVuetifyMarkdown


class Page(models.Model):
    title = models.CharField(max_length=200)
    body = models.TextField()

    def get_body_as_markdown(self):
        return mark_safe(markdown.markdown(self.body, extensions=[PythonVuetifyMarkdown()]))

With this, you can create a Page object, and when displaying the body, you can use Page.get_body_as_markdown() to pass in the Markdown-formatted code.

Features

Currently, this extension modifies several tags, and adds spoiler text functionality. The styles can be found on the Vuetify Typography page.

  • <h1> → <h1 class="text-h1">
  • <h2> → <h2 class="text-h2">
  • <h3> → <h3 class="text-h3">
  • <h4> → <h4 class="text-h4">
  • <h5> → <h5 class="text-h5">
  • <h6> → <h6 class="text-h6">
  • <p> → <p class="text-body-1">
  • <a> → <a class="text-no-decoration">
  • *text* → <span class="font-weight-medium">text</span>
  • **text** → <span class="font-weight-bold">text</span>
  • ***text*** → <span class="font-weight-black">text</span>
  • !!text!! → <span class="font-weight-thin">text</span>
  • !text! → <span class="font-weight-light">text</span>
  • _text_ → <span class="font-italic">text</span>
  • __text__ → <span class="font-decoration-underline">text</span>
  • --text-- → <span class="font-decoration-line-through">text</span>
  • ||text|| → "â–’â–’â–’â–’" normally, "text" on hover

Support

There is none. This is a small side project, like 30 minutes of research and work went into it. Good luck.

Metadata

Release files for PythonVuetifyMarkdown 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PythonVuetifyMarkdown 0.2.1
File Size Uploaded
pythonvuetifymarkdown-0.2.1.tar.gz 4.1 kB Details

Release files / pythonvuetifymarkdown-0.2.1.tar.gz

Download URL pythonvuetifymarkdown-0.2.1.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c8a96a75ba5c49b95918ab7c16de02dee6a6137e72a98bdb787f2f1b027419e7
BLAKE2b-256 checksum
How to use checksums
0988367fa0211a9d981c184821b6365b7000479010b7d15d9117f8b357d94103
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file

0.2.0

1 release file

0.1.4

1 release file

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page