Syntax Colouring: YAML, MD and Jekyll

595 views
Skip to first unread message

Alain Paradis

unread,
Jun 16, 2016, 10:24:29 AM6/16/16
to BBEdit Talk
Hello,

I am building a Jekyll web site. Its files have the .md extensions, that Jekyll wants. The content in the files is all YAML. The syntax colouring seems to be reverting to MarkDown because of the file extension. Is there a way to tell BBedit to keep the YAML syntax colouring despite the .md file extension?

Thanks in advance for your suggestions.

François Schiettecatte

unread,
Jun 16, 2016, 10:31:15 AM6/16/16
to bbe...@googlegroups.com
Alain

Can’t you change the file type at bottom of the editing window?

François
> --
> This is the BBEdit Talk public discussion group. If you have a
> feature request or would like to report a problem, please email
> "sup...@barebones.com" rather than posting to the group.
> Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
>
> ---
> You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
> To post to this group, send email to bbe...@googlegroups.com.

Rich Siegel

unread,
Jun 16, 2016, 10:32:04 AM6/16/16
to bbe...@googlegroups.com
On Thursday, June 16, 2016, Alain Paradis
<al...@paradisfamily.ca> wrote:

>I am building a Jekyll web site. Its files have the .md
>extensions, that Jekyll wants. The content in the files is all
>YAML. The syntax colouring seems to be reverting to MarkDown
>because of the file extension. Is there a way to tell BBedit to
>keep the YAML syntax colouring despite the .md file extension?

Yes; but I encourage you to go back and review these
requirements. From my reading of the Jekyll documentation,
content is stored in either Markdown (.md) or HTML (.html) or
combination (.html.md), and there is no case in which YAML used
by Jekyll is stored in a file whose name ends in anything other
than ".yml".

That said, if you insist on going down that road :-) you can add
filename extension mappings in the Languages preferences.

R.
--
Rich Siegel Bare Bones Software, Inc.
<sie...@barebones.com> <http://www.barebones.com/>

Someday I'll look back on all this and laugh... until they
sedate me.

Watts Martin

unread,
Jun 17, 2016, 3:10:15 PM6/17/16
to bbe...@googlegroups.com
On Thu, Jun 16, 2016 at 7:32 AM, Rich Siegel <sie...@barebones.com> wrote:
 
Yes; but I encourage you to go back and review these requirements. From my reading of the Jekyll documentation, content is stored in either Markdown (.md) or HTML (.html) or combination (.html.md), and there is no case in which YAML used by Jekyll is stored in a file whose name ends in anything other than ".yml".

Well, there's one case I know of: YAML metadata at the top of a file, which pretty much 100% of the Jekyll-related files I work with have. (While it'd be nice if BBEdit recognized those, the omission has never been a really big deal in my experience.)

If Alain's file is really *all* YAML, though, I'm not sure why it's being put in a Markdown file; that sounds more like it's configuration information, or perhaps other data being used by the build process -- our company's web site has a few custom files like that to generate sidebar indexes, for instance. But since they're pure YAML, we use the .yml extension.
 

Brian Christiansen

unread,
Jun 19, 2016, 9:26:50 PM6/19/16
to BBEdit Talk
Here's the trick, and it's an "issue" I've dealt with for years, as the system Statamic (Statamic.com) uses essentially the same syntax: the file extension is HTML or MD, and the text in the file is HTML or MD, but that MD (etc) lives as the "value" in a YAML key: value pair. As such, BBEdit's syntax coloring gets all confused. In fact sometimes when I'm dealing with a string of HTML as the value, I can't even envoke the "Edit Markup" command, because BB doesn't notice my cursor is in the middle of a string of HTML (I imagine because the file type is .md, even though HTML is fully parsable within a line of MD.

I believe there's a "Ruby in HTML" syntax? (Forgive me, I'm on my iPad right now, not near my Mac) It would be amazing if there was a way to set two syntaxes, one for the key: value language, and one for the value strings. So you could say [pull down 1:] YAML (with [optional pull down 2:] Mardown. I always thought I was fringe enough for this not to be worth writing to BB with this as a feature request—but honestly, Jekyll is wildly popular right now, I may be less and less fridge by the day. Secondly, it would also be awesome to allow the "Edit Markup" command in any syntax, since HTML is stuck inside many scripting languages. This request is probably far less fringe.

~brian
Reply all
Reply to author
Forward
0 new messages