Comments (9)
Could you paste the HTML code you're using?
from zero-md.
import 'zero-md';
class Foo extends LitElement {
static properties = {item: {type: Object}};
render() {
return html`
${this.item?.changelog && this.item.changelog !== '' ? html`
<zero-md @zero-md-rendered="${() => this.dispatchEvent(new Event('notifyResize'))}">
<script type="text/markdown">${this.item.changelog}</script>
</zero-md>
` : ''}
`;
}
}
from zero-md.
The script is added to document.head and loaded, but may be some race condition.
What is being added into <head>
?
Also would be great in general to have this be a local file as I currently have to allow all of cdn.jsdelivr.net for this.
It's possible to load dependencies locally. If you can give more details about your code and setup maybe I can help.
Lastly, you should probably import the <zero-md>
class, then define the customElement
:
import ZeroMd from 'zero-md'
customeElements.define('zero-md', ZeroMd)
class Foo extends LitElement {
...
}
from zero-md.
<script src="https://cdn.jsdelivr.net/gh/PrismJS/prism@1/prism.min.js" data-manual=""></script>
<script src="https://cdn.jsdelivr.net/gh/PrismJS/prism@1/plugins/autoloader/prism-autoloader.min.js"></script>
are added to head.
I'm using rollup/nodeResolve to bundle for production. Just imports (w/nodeResolve server) for dev.
I'm using the component in multiple places in the application so that would result in a duplicate registry error.
from zero-md.
Also seeing double rendering (maybe) related to this. Calling .refreshContent()
prints this error.
from zero-md.
FYI, rolling back to v2.1.1 fixed the double rendering issue so that is likely something separate from Prism.
from zero-md.
Thanks for investigating. I think some of the v2.2.0
code re dynamic content refresh needs to be refactored. I'll get to clearing this backlog soon. 🙏
Will keep you updated in this thread.
from zero-md.
Hi, FYI there's a new v2.3.0
release - are you still encountering issues with this?
from zero-md.
Thanks, yes this seems to have resolved the double loading issue. I will close this for now and keep an eye out for the previously mentioned prism issue.
from zero-md.
Related Issues (20)
- Thanks a ton!
- Parsing img tags in md [ERROR with src] HOT 1
- fallback markdown script renders as code block HOT 1
- Marked.js v5 support HOT 2
- github markdown emoji HOT 3
- Inline markdown doesn't work HOT 2
- zero-md-copy to clipboard HOT 1
- v3 Question: Is there an easy way to force the theme to be light or dark? HOT 3
- BUG: `goto` (scroll to selected element) broken when `no-shadow` enabled HOT 2
- Discussion: Anchor.js usability (for on-hover anchor links) HOT 5
- Mathjax zero-md@{1,2} bug HOT 3
- Mathjax no-shadow window.ZeroMdConfig HOT 2
- Render Mathjax on content change HOT 2
- Is there a way to use mathjax while still supporting shadow dom? HOT 2
- Does zero-md support admonition marked plug-in? HOT 7
- Parse/Render text within HTML tags HOT 2
- prism.js seems to not recognize C++? HOT 3
- Mermaid Support Broken Since Version 2.5.1 HOT 3
- Display table of content TOC HOT 4
- Markdown not translated into HTML HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zero-md.