Giter VIP home page Giter VIP logo

Comments (3)

zerodevx avatar zerodevx commented on June 14, 2024

Hi, sorry for the late reply.

The underlying tech in zero-md is web components, so in the example you provided, the styles from outside the shadowRoot will not pierce within. (It's a feature not bug 🤣 )

I guess in your use case, you are looking to merge custom styles into the default (provided) styles. There are ways to do it - but all not particularly elegant. I will look at improving that in the next release.

In the meantime, you could try:

<style>
#menu ul {
    margin: 0;
    padding: 0;
}
#menu li {
    display: inline;
    padding: 0;
    margin: 0;
}
</style>
<!-- Add the `no-shadow` attribute -->
<zero-md id="menu" src="index.md" no-shadow></zero-md>

This renders the markdown into light dom instead, so your custom styles will take effect.

from zero-md.

neskk avatar neskk commented on June 14, 2024

Thank you very much for the reply.
I didn't know it was an intentional feature to not let styles "pierce within". 😅

I guess in your use case, you are looking to merge custom styles into the default (provided) styles. There are ways to do it - but all not particularly elegant. I will look at improving that in the next release.

That sounds great, I think it is important let users override/remove all CSS, but also merge their styles. Perhaps a merge-css-urls attribute would suffice to "build upon" the global css-urls instead of replacing them.

I'm specifying the default css-urls in addition to my custom CSS stylesheet, but I will try the no-shadow attribute.

Keep up the great work!

from zero-md.

zerodevx avatar zerodevx commented on June 14, 2024

V2 is released (finally) with built-in support that may help with your use-case.

From your first post #34 (comment) - with V2 your code may look something like this:

<zero-md src="index.md">
  <template data-merge="append">
    <style>
      ul {
        margin: 0;
        padding: 0;
      }
      li {
        display: inline;
        padding: 0;
        margin: 0;
      }
    </style>
  </template>
</zero-md>

Closing this for now; feel free to re-open if something's wrong! 🎉

from zero-md.

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.