Git Product home page Git Product logo

Comments (5)

BoPeng avatar BoPeng commented on June 3, 2024

I notice that extras are not implemented as separate modules, so this has to be incorporated into lib/markdown2.py. Does this look like a decent feature to justify the acceptance of a PR?

from python-markdown2.

nicholasserra avatar nicholasserra commented on June 3, 2024

Where do you see this preview information being stored?

There's also pre and post process hooks in the codebase if you wanna import and then subclass the module, then add your own data as you see fit.

Also check out https://github.com/michaelhelmick/lassie/

from python-markdown2.

BoPeng avatar BoPeng commented on June 3, 2024

Thanks for pointing me to lassie. Basically I want to process markdown (or generated HTML content) and add previews. It has not been decided yet but I think I want to convert paragraphs with a single link to a block with image, title etc. Something like

I see

https://www.cnn.com/2022/12/04/us/power-outage-moore-county-criminal-investigation/index.html

today

will be converted to something like

I see

[ image ] Title
[ image [ author, date, etc

today

from python-markdown2.

nicholasserra avatar nicholasserra commented on June 3, 2024

Got it. Sounds interesting. But also very specific. Would probably be a worthwhile extra assuming it was built out to allow customization. Not sure if that's worth it for you to work on, but if it were to go down that path, it would probably be accepted.

from python-markdown2.

BoPeng avatar BoPeng commented on June 3, 2024

Sounds interesting. But also very specific ... built out to allow customization.

I am using python-markdown2 to convert user input into HTML in the backend of a website. I am calling markdown2 like

markdown(my_text, extras= { ...})

so I essentially need a hook like

def link_to_preview(link):
    return html-based-on-lassie

markdown(my_text, extras={
    'link_preview': {
        'select': 'single-paragraph',
        'processor': link_to_preview
    }
 }

So that markdown2 will look for particular types of links (in this case single-link-paragraphs) and replace them with results from a user-provided processor.

from python-markdown2.

Related Issues (20)

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.