PolymerElements/marked-element

Why <script type="text/markdown">?

ebidel opened this issue · 8 comments

It would be cool for the light dom to support <template> instead of the old type hack. Something like https://github.com/ebidel/polymer-change/blob/master/elements/code-cycler.html#L11-L22

cc @notwaldorf

In general if the text is not HTML, it's bad (wasteful, mostly) for the parser to parse the text into nodes at all, and <script type="..."> has that benefit (while <template> is still parsing it as HTML), but the differences may be negligible. @cdata suggested <noscript> as a container, which both gives no-parsing, and won't close if the example has a closing </script> (or </template>, in the template case).

I have a question here, I tried to put my markdown in a file and use

<script type="text/markdown" src="/data/blog-post.md"></script>

but it didn't work, does it only work if the markdown is directly inside the script tag or am I doing something wrong?

@kevinpschaaf good point. Albeit small, perf win == perf win. You'd also save on the .innerHTML serialization.

It seems when using <script type="text/markdown"> double curly/square brackets are being stripped (because of binding?).

<marked-element>
  <div class="markdown-html"></div>
  <script type="text/markdown">
    {{users}}
  </script>
</marked-element>

shows nothing
related issue Polymer/polymer#3726

@web-devel Is there a reason you wouldn't use the markdown property?

@notwaldorf Can we close this?

@everyone-in-issue <script type="text/markdown"> Is No Longer Work Correctly

@notwaldorf Can we open this?