Markdown: Convert Markdown via Jinja filter in the template
This gets rid of the use of javascript for converting node/post description. Now we only use markdown.js for real time as-we-type stuff, like node/post editing or commenting.
This commit is contained in:
parent
c086cff36e
commit
7252055e4a
@ -1,17 +1,5 @@
|
||||
script(type="text/javascript").
|
||||
|
||||
/* Convert Markdown */
|
||||
var convert_fields = '.node-details-description, .blog_index-item .item-content';
|
||||
var convert = new Markdown.getSanitizingConverter();
|
||||
Markdown.Extra.init(convert);
|
||||
convert = convert.makeHtml;
|
||||
|
||||
|
||||
/* Parse description/content fields to convert markdown */
|
||||
$(convert_fields).each(function(i){
|
||||
$(convert_fields).eq(i).html(convert($(convert_fields).eq(i).text()));
|
||||
});
|
||||
|
||||
ProjectUtils.setProjectAttributes({isProject: false});
|
||||
|
||||
// Click anywhere in the page to hide the overlay
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
| {% if node.description %}
|
||||
.node-details-description#node-description
|
||||
| {{node.description}}
|
||||
| {{ node.description | markdown }}
|
||||
| {% endif %}
|
||||
|
||||
include ../../_node_details
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
| {% if node.description %}
|
||||
.node-details-description#node-description
|
||||
| {{node.description}}
|
||||
| {{ node.description | markdown }}
|
||||
| {% endif %}
|
||||
|
||||
include ../../_node_details
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
| {% if node.description %}
|
||||
.node-details-description#node-description
|
||||
| {{node.description}}
|
||||
| {{ node.description | markdown }}
|
||||
| {% endif %}
|
||||
|
||||
include ../../_node_details
|
||||
|
@ -25,7 +25,7 @@ a.blog_index-header(href="{{ node.url }}")
|
||||
| {{ node.name }}
|
||||
|
||||
.item-content
|
||||
| {{ node.properties.content }}
|
||||
| {{ node.properties.content | markdown }}
|
||||
|
||||
| {% endmacro %}
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
| {% if node.description %}
|
||||
.node-details-description
|
||||
| {{node.description}}
|
||||
| {{ node.description | markdown }}
|
||||
| {% endif %}
|
||||
|
||||
section.node-children.group
|
||||
|
@ -12,7 +12,7 @@
|
||||
| {% if node.description %}
|
||||
section.node-row
|
||||
.node-details-description
|
||||
| {{node.description}}
|
||||
| {{ node.description | markdown }}
|
||||
| {% endif %}
|
||||
|
||||
| {% if children %}
|
||||
|
@ -12,7 +12,7 @@
|
||||
| {% if node.description %}
|
||||
section.node-row
|
||||
.node-details-description
|
||||
| {{node.description}}
|
||||
| {{ node.description | markdown }}
|
||||
| {% endif %}
|
||||
|
||||
| {% if children %}
|
||||
|
@ -93,7 +93,7 @@
|
||||
|
||||
| {% if node.description %}
|
||||
.node-details-description#node-description
|
||||
| {{node.description}}
|
||||
| {{ node.description | markdown }}
|
||||
| {% endif %}
|
||||
|
||||
| {% if node.properties.license_notes %}
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
| {% if node.description %}
|
||||
.node-details-description#node-description
|
||||
| {{node.description}}
|
||||
| {{ node.description | markdown }}
|
||||
| {% endif %}
|
||||
|
||||
.node-details-meta.footer
|
||||
@ -32,7 +32,7 @@ script.
|
||||
// Push the correct URL onto the history. This push happens after the id has
|
||||
// been pushed to the history already. We should probably keep only this and
|
||||
// skip the project-level displayNode push.
|
||||
|
||||
|
||||
var url = '{{ node.properties.url }}'
|
||||
var replace_state = {nodeId: '{{node._id}}', url: url};
|
||||
window.history.replaceState(
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
| {% if project.description %}
|
||||
.node-details-description
|
||||
| {{ project.description }}
|
||||
| {{ project.description | markdown }}
|
||||
| {% endif %}
|
||||
|
||||
| {# Until we implement urls for pages
|
||||
|
Loading…
x
Reference in New Issue
Block a user