admin管理员组

文章数量:1026989

I am using the Ghost Blogging Software and tumbled over Tangle these days. So it would be great to be able to use that in some of my Blog posts.

I have included the Tangle-files in my theme and load them in default.hbs. However, I cannot find a way to embed some javascript (to be executed, but not displayed) in the markdown document. I would like to write the javascript in the markdown document too as I do not want to add js-Files to my theme each time I write a blog post with reactive content.

Is there a way to do this?

I am using the Ghost Blogging Software and tumbled over Tangle these days. So it would be great to be able to use that in some of my Blog posts.

I have included the Tangle-files in my theme and load them in default.hbs. However, I cannot find a way to embed some javascript (to be executed, but not displayed) in the markdown document. I would like to write the javascript in the markdown document too as I do not want to add js-Files to my theme each time I write a blog post with reactive content.

Is there a way to do this?

Share Improve this question edited Nov 3, 2014 at 19:32 ChriPf asked Nov 3, 2014 at 19:08 ChriPfChriPf 2,7801 gold badge25 silver badges25 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

It seems there is. You should be able to include the JavaScript you want to run by just placing it inside of <script> tags like they talk about on this post

Edit: To further explain, a markdown file is just different syntax for creating html tags, but you can use regular html and script tags inside them. To get an script to run per the above link, you should only need to include whatever js you want to run inside of the script tags. This example should work inside of a markdown post file to replicate the Tangle example on the doc page

When you eat <span data-var="cookies" class="TKAdjustableNumber"> cookies</span>,
you consume <span data-var="calories"> calories</span>.

<script>
var tangle = new Tangle(document, {
    initialize: function () { this.cookies = 3; },
    update:     function () { this.calories = this.cookies * 50; }
});
</script>

I am using the Ghost Blogging Software and tumbled over Tangle these days. So it would be great to be able to use that in some of my Blog posts.

I have included the Tangle-files in my theme and load them in default.hbs. However, I cannot find a way to embed some javascript (to be executed, but not displayed) in the markdown document. I would like to write the javascript in the markdown document too as I do not want to add js-Files to my theme each time I write a blog post with reactive content.

Is there a way to do this?

I am using the Ghost Blogging Software and tumbled over Tangle these days. So it would be great to be able to use that in some of my Blog posts.

I have included the Tangle-files in my theme and load them in default.hbs. However, I cannot find a way to embed some javascript (to be executed, but not displayed) in the markdown document. I would like to write the javascript in the markdown document too as I do not want to add js-Files to my theme each time I write a blog post with reactive content.

Is there a way to do this?

Share Improve this question edited Nov 3, 2014 at 19:32 ChriPf asked Nov 3, 2014 at 19:08 ChriPfChriPf 2,7801 gold badge25 silver badges25 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

It seems there is. You should be able to include the JavaScript you want to run by just placing it inside of <script> tags like they talk about on this post

Edit: To further explain, a markdown file is just different syntax for creating html tags, but you can use regular html and script tags inside them. To get an script to run per the above link, you should only need to include whatever js you want to run inside of the script tags. This example should work inside of a markdown post file to replicate the Tangle example on the doc page

When you eat <span data-var="cookies" class="TKAdjustableNumber"> cookies</span>,
you consume <span data-var="calories"> calories</span>.

<script>
var tangle = new Tangle(document, {
    initialize: function () { this.cookies = 3; },
    update:     function () { this.calories = this.cookies * 50; }
});
</script>

本文标签: Can I use embedded Javascript in a ghost blog entryStack Overflow