Coder Social home page Coder Social logo

henri470 / mdx_truly_sane_lists Goto Github PK

View Code? Open in Web Editor NEW

This project forked from radude/mdx_truly_sane_lists

0.0 0.0 0.0 34 KB

Extension for Python-Markdown that makes lists truly sane. Custom indents for nested lists and fix for messy linebreaks and paragraphs between lists.

License: MIT License

Python 100.00%

mdx_truly_sane_lists's Introduction

Mdx Truly Sane Lists

Build Status

An extension for Python-Markdown that makes lists truly sane. Features custom indents for nested lists and fix for messy linebreaks and paragraphs between lists.

Features

  • nested_indent option: Custom indent for nested lists. Defaults to 2. Doesn't mess with code indents, which is still 4.

  • truly_sane option: Makes linebreaks and paragraphs in lists behave as usually expected by user. No longer adds weird p, no extra linebreaks, no longer fuses lists together when they shouldn't be fused (see screenshots and examples below). Defaults to True.

  • Inherits sane lists behavior, which doesn't allow the mixing of ordered and unordered lists.

Installation

pip3 install mdx_truly_sane_lists
Directly from git:
pip3 install git+git://github.com/radude/mdx_truly_sane_lists

Usage

Basic:

from markdown import markdown

# Default config is truly_sane: True, nested_indent: 2
markdown(text='some text', extensions=['mdx_truly_sane_lists']) 

With explicit config:

from markdown import markdown

markdown(text='some text',
         extensions=[
             'mdx_truly_sane_lists',
         ],
         extension_configs={
             'mdx_truly_sane_lists': {
                 'nested_indent': 2,
                 'truly_sane': True,
             }},
         )

Screenshots and examples

You can preview the new behaviour live at rentry.co (uses nested_indent: 2, truly_sane: True)

Some ugly screenshots because I'm lazy and cannot into gimp:

HTML

Data:

- attributes
 
- customer 
    - first_name
    - family_name
    - email
- person
    - first_name
    - family_name
    - birth_date
- subscription_id

- request

No extension:

<ul>
<li>
<p>attributes</p>
</li>
<li>
<p>customer </p>
<ul>
<li>first_name</li>
<li>family_name</li>
<li>email</li>
</ul>
</li>
<li>person<ul>
<li>first_name</li>
<li>family_name</li>
<li>birth_date</li>
</ul>
</li>
<li>
<p>subscription_id</p>
</li>
<li>
<p>request</p>
</li>
</ul>

Truly sane + 4 spaces:

<ul>
<li>attributes</li>
</ul>
<ul>
<li>customer <ul>
<li>first_name</li>
<li>family_name</li>
<li>email</li>
</ul>
</li>
<li>person<ul>
<li>first_name</li>
<li>family_name</li>
<li>birth_date</li>
</ul>
</li>
<li>subscription_id</li>
</ul>
<ul>
<li>request</li>
</ul>

mdx_truly_sane_lists's People

Contributors

radude avatar relativisticelectron avatar ifplusor avatar thewoolleyman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.