Syntax highlighting Markdown via Assemble.io - incomplete - node.js

Am I missing something? I have a rendering pipeline set up with assemble.io via an express server and everything is rendering as expected. However, when I add in bracket fences for Markdown there seems to be an issue with the syntax highlighting. It does drop the code into <code> and <pre> tags as expected and when I add in the language identifier after the top fence it does add in the class="language-[LANG] like you would think it would, however, it does nothing to the code within it (e.g. wrapping the tag elements, attributes, important names, etc. in span tags).
Is there a helper I need to add to the pipeline and pass the file through? So far I've tried adding prismjs, but that flattened the entire page into code (not ideal).
Result:
<a href="">this is the link</a>
Expected:
<<span class="some-tag-class">a</span> <span class="some-name-class">href</span>="">this is the link</a>

Looking at the markdown documentation directly or at the assemble.io documentation does no good.
It's clearly listed on the helper-markdown github/npm sites respectivly.

Related

Page template - Object reference not set to an instance of an object

I have a page template that has this line of code below:
<div id="<%= CurrentDocument.NodeAlias %>" class="lvl3">
Things work - the id value shows correctly. However, when using the Page Templates module Design tab, there's an error. In Event log, I saw the error message "Object reference not set to an instance of an object". Taking the id snippet out, the error is gone. I'm not sure what the error means and how to fix it. Could you help?
I do need some page-specific unique identifier in there (NodeAlias in this case) for other purposes.
The answer is pretty simple - if you open your page template in Kentico Page Templates application - your CurrentDocument is always null (because you are editing Template itself without specific document).
You could do absolutely the same thing in Pages application with the Design tab. It's also possible to edit all the template properties from there, including the Layout:
Using code blocks on page template layout is not supported. I assume you are using ASCX layout. Moreover your code looks more like a macro - so, maybe you are using HTML layout type? If yes, then the syntax should be {%CurrentDocument.NodeAlias%}
If you are using ASCX layout you may face also this issue: https://devnet.kentico.com/articles/the-controls-collection-cannot-be-modified-because-the-control-contains-code-blocks
Note that in portal engine the life cycle is bit modified, so we cannot ensure the code blocks will work every time - it may work sometimes. It mainly depends on what other web parts/controls and in what order are placed in the page template. I would rather recommend using the workaround from the article.
Or, you can give it a try, with no guarantee, this may work in certain cases, you need to specify the full namespace:
<%= CMS.MacroEngine.MacroResolver.Resolve("{%CurrentDocument.NodeAlias#%}") %>

Selecting parent elements with WebdriverJS

I'm trying to create some scripts which require moving through a lot of on-the-fly HTML with random IDs. They require getting the parents of an element - but I'm not sure how to implement this in WebdriverJS.
If I access the element I want via a console, I can do the following to get it;
document.querySelector('span[email="noreply#example.com"]').parentNode.parentNode
Is there a way to do this in WDJS? I've looked and can't see anything obvious - it's specifically the parent stuff I'm having issue with. I saw that a possible solution may be xPath however I'm unsure of syntax having never used it before.
Thanks in advance!
I don't know the syntax of WebDriverJS. But the XPath is as below, you need a way to fit it in somewhere.
This is based on your CSS Selector, so please show HTML if needed.
.//span[#email='noreply#example.com']/../..
For example, if you have HTML like this
<div>
<div>
<span email="noreply#example.com">Contact me</span>
</div>
</div>
You can avoid using .. to go up.
.//div[./div/span[#email='noreply#example.com']]
If you have more levels to look up, another handy method would be using ancestor from XPath Axes.
Also, as #sircapsalot brought up, CSS selectors spec doesn't support parent selecting, so XPath is the only way to go, unless you inject JS.

Passing entry_ids to channel:entries tag with low variables entries select

I'm trying to pass entry_ids to a channel entries tag using low variables entry_select. When i place the following tag by itself in a template it outputs a list of 3 pipe separated entry_ids: {exp:low_variables:single var='lv-home-groups'}
however when I add the same code to the following channel:entries tag nothing is output.
{exp:channel:entries channel="groups" entry_id="{exp:low_variables:single var='lv-home-groups'}" disable="category_fields|pagination"}
code here
{/exp:channel:entries}
I've tried early and late parsing but can't get it to work. If i manually place the entry_ids it works fine. I'm trying to avoid using an embedded template for performance reasons.
Here's how: make sure early parsing is enabled for that variable, and then use the variable syntax instead of the tag syntax:
{exp:channel:entries channel="groups" entry_id="{lv-home-groups}"}
code here
{/exp:channel:entries}

Inner tags not parsing with Expression Engine 2 custom plugin

I've written a simple plugin that basically loops through a bunch of entries. The plugin is used to only display entries that contain a feature image, amongst some other minor logical conditions. The use of my tag looks something like this:
{exp:myentries:withimages channel="mychannel"}
<!-- This works fine -->
<h1>{title}</h1>
<!-- But nested exp:... tags don't seem to parse? -->
<p>{exp:ce_img:single src="feature_image"}</p>
{/exp:myentries:withimages}
I am calling
return $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $data);
from my custom EE plugin, the data is there, but only the nested {exp:... tags don't want to parse.
I've followed the online User Guide for creating plugins as close as I possibly could, but I need some help getting the other tags to parse? If I simply output {feature_image}, the field renders the src value for the image as expected.
Can anyone possibly shed some light on what I'm doing wrong?
You want to put parse="inward" parameter in your {exp:myentries:withimages tag, otherwise the template will try to parse the exp:ce_img call before {feature_image} is set.
{exp:myentries:withimages parse="inward" channel="mychannel"}
The parse="inward" will tell EE to run this tag first before parsing any other tags within the tag pair.
There are two important typos in your code.
{exp:ce_img:singe src="feature_image"}
Should read:
{exp:ce_img:single src="{feature_image}"}
If those differences are actually present in your template, then that would be it I believe.

Pagination on Single-Entry view in ExpressionEngine

I am building a website with ExpressionEngine as the CMS. There is a "Work" section that displays all the projects, and a detail view that shows each project individually. It is at this point, on the single-entry view that I would like to have "prev" and "next" pagination. In my tests I have made it work when the URL is "somedomain.com/index.php/work/detail/" but it does not work when the specific entry is part of the URL: "somedomain.com/index.php/work/detail/some_project/"
I've tried putting the pagination code outside of the {exp:weblog:entries} tag as well as within it, but to no avail. This is what my pagination code looks like:
{paginate}
<ul>
{if previous_page}
<li>< previous</li>
{/if}
{if next_page}
<li>next ></li>
{/if}
</ul>
{/paginate}
You are using pagination for lists of entries, what you need is the next / previous entry tags:
http://expressionengine.com/user_guide/modules/channel/entry_linking.html
Hmm. I'm not sure what the issue is here, as I've never used the {pagination} tag in that way. After checking out the docs, I see that the example code for prev/next links inside of the {pagination} tag is wrapped inside of an {exp:comment:entries} loop instead of the normal {exp:channel:entries} loop.
The docs aren't very clear about the scope of this particular feature of the {pagination} tag. You might want to double check that, in your {exp:channel:entries} loop, you haven't included pagination as a value in the disable parameter.
You could also check out the page in EE's user guide about Next/Prev Linking, which details the use of {exp:channel:next_entry} and {exp:channel:prev_entry} tags in place of the {pagination} tag that you've been using. I've used these tags without a hitch, so I definitely recommend trying them if you can't get your method to work.
Best of luck!

Resources