Help with an ENML action

I’m attempting to use ENML for the first time. I don’t know XHTML at all. I’ve been using different resources to try to make it work. Here is my action:

Screenshot 2020-04-23 11.37.12

It’s set to prepend and render in ENML (obviously).
It doesn’t work! LOL. If I remove the color part, it works.

%%[[date|%G.%m.%d @ %H%M]]
Test Text
[[draft]]%%

Any comments or corrections would be awesome! Thanks

Is there a reason you want to use ENML? You need a pretty good understanding of what it is and how to create valid XML to write it directly. In most cases you would be better off using a different output format.

If you are writing this for an iOS Evernote action step in Drafts, I would just use the “Markdown” template output type, with the template like:

[[date|%G.%m.%d @ %H%M]]

Test Text

[[draft]]

Drafts will take case of convert the content to ENML for you.

Because I’m looking to have the ‘Test Text’ section colored. It’s a journal. I’ll have different actions for different types of journal entries with the text of (Test Text) and it’s color different to easily ID different categories of journal entries. I would love to use Markdown. While I’m a rookie at it…I definitely understand it MUCH better than ENML. I have the Markdown version mostly working. There’s one thing I’d like to accomplish that I don’t know if it’s possible. But I’m fairly sure that formatting text to a certain color in markdown doesn’t work. Am I wrong?

The ‘one thing’ I can’t figure out (besides formatting color) has to do with prepending. I have a Evernote link at the top of the note that I want to stay at the top of the note. I want the prepended text coming from Drafts to be entered on the 2nd line of the note. Not sure how to accomplish this or even if this is possible.

For the most part, ENML is HTML. That what the Markdown conversion relies on to work, since Markdown outputs HTML. Markdown also allows inline HTML tags, so you can include styled HTML markup (as long as it’s tags supported by ENML, but that’s most of the common ones).

So, this template, set to output Markdown, would work to get you bold, red text:

## [[date]]

<p style="font-weight:bold;color:red;">Here's some bold red text!</p>

[[draft]]

1 Like

Thank you. You’re the man.

Is there a way to code it so there are no extra lines between? All single spaced? I’ve been experimenting (NOOB) and can’t figure it out.

See if this helps get you closer.

## [[date]]
<span style="font-weight:bold;color:red;">Here's some bold red text!</span><br><span style="font-weight:bold;color:blue;">Here's some bold blue text!</span>
[[draft]]
1 Like

Thanks @sylumer…however when I copied and pasted that code and then ran the action I received an error code. Dang!!

That example probably won’t quite do it, because of the header and Markdown not respecting line breaks.

You might be better off (going back to your original example), with:

<b>[[date|%G.%m.%d @ %H%M]]</b><br/>
<span style="font-weight:bold;color:red;">Here's some bold red text!</span><br/>
[[draft]]
1 Like

Span may not be supported by ENML then. I didn’t get time to try it over breakfast myself today, and it’s a long time since I read Evernote’s ENML spec.

:man_shrugging:t2:

span should be OK. I think the <br> in your example would throw an error. ENML is strict XML validated, so <br/> with the close is required.

That last set of code did it! Thank you so much!!!

I feel incredibly dimwitted. I used your last code. Modified it a little for font weight and the text content I wanted to be red. It worked fantastically.
Screenshot 2020-04-24 07.29.31

I then modified it again for a different category of journal entry. I changed the color and text. I tried both green and blue. Drafts threw and error.
Screenshot 2020-04-24 07.30.18

What am I doing wrong?

Sorry to be so slow on this…

Also…how do I get the code to show up like in your post @agiletortoise? When I copied and pasted it and then posted, the formatting code disappeared. I ended up uploading screenshots.

Looking at your screen shot, I would say that the closing double quote of the style attribute of the span tag is a smart quote rather than a plain double quote.

Place your code between triple backticks.

e.g.

```
<b>foo</b><br/>
```

will show as

<b>foo</b><br/>

That was it! Thank you!! I’m not even sure how that happened. I just copied and pasted from one action to the other. It should have been identical.

Cheers.