[TxMt] Re: Regex For Markdown Fenced Code Blocks

Robert J. Rockefeller bob at bobrockefeller.com
Wed Feb 11 13:54:34 UTC 2015


Some progress, perhaps, but still not there.

I better understand how TextMate’s standard Markdown grammar considers paragraphs and it probably makes sense for me to stick with that and separate other structures from paragraphs with a newline. So I did and my text to match is now:

After getting all that done, my project folder for Grav is shown on the right. My Vagrantfile is:

```
Vagrant.configure("2") do |config|

  config.vm.box = "scotch/box"
  config.vm.network "private_network", ip: "192.168.33.10"
  config.vm.hostname = "scotchbox"
  config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]

end
```

When I'm ready to work, I open iTerm2 to `grav/public` and type `vagrant up`, wait a bit for Vagrant to do its thing and report that it's done, send my browser to `http://192.168.33.10`, and go to town.

My use of Vagrant is at the low end of the complexity spectrum. There is so much more that Vagrant can do and I'm still moving slowly towards more advanced uses such as sharing the server across the local network so that other devices (my iPad and iPhone) can access the server. Or even sharing it across the Internet so that other people can see what I'm working on.

I switched the order of the inline and block raw rules and have this:

{	patterns = (
		{	name = 'source.yaml.front-matter';
			begin = '\A-{3}';
			end = '-{3}';
			patterns = ( { include = 'source.yaml'; } );
		},
		{	name = 'text.html.markdown.classes';
			begin = '{';
			end = '}';
		},
		{	name = 'markup.raw.block.markdown';
			begin = '^`{3}';
			while = '^[^`{3}]|^\n';
		},
		{	name = 'markup.raw.inline.markdown';
			begin = ' `';
			end = '`(?=[ .,;-=+])';
		},
	);
}

And I changed the injection selector to: L:(text.html.markdown $).

The raw block still begins correctly by finding and matching the first ```. But it still misses the second ``` and matches to the end of the document.

What else have I missed?

Bob
-------------------
Robert J. Rockefeller
Richmond Hill, GA
www.bobrockefeller.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20150211/1b232eae/attachment.html>


More information about the textmate mailing list