Skip to content

Conversation

@davidlowryduda
Copy link
Contributor

A Pull Request fixing #234.

Note: one additional test fails. This is the metadata2.text test, which is a test for having metadata without a fenced block. It's my understanding from the documentation and my experience with other markdown tools that metadata is supposed to come in a fenced block, and therefore that this test is for slightly odd behavior. Am I wrong about the intended behavior?

I also notice that some of the documentation is a bit light, and I intend on adding a bit to that in the future.

As noted in Issue trentm#234

  trentm#234

the metadata extra uses regex that is too greedy and can eat more than
what is intended if links appear in the markdown. This small change
corrects this.

Resolves: trentm#234
@nicholasserra
Copy link
Collaborator

Thanks for the work on this :)

Looks like you need to rebase or merge master in since I made some changes in master.

As far as the failing test, it looks like the test in question doesn't have to do with fenced code blocks? Maybe i'm missing that. I see a metadata2 test failing in travis.

@davidlowryduda
Copy link
Contributor Author

I'm sorry, when I mentioned a "fenced block", I just meant the opening metadata block. That is, I had thought that metadata in markdown should be separated by a --- block, such as

---
title: SOMETITLE
etc: ETCETERA
---

Rest of markdown document

But the metadata2 test is about testing the metadata extra on a document that doesn't have fences, like

title: SOMETITLE
etc: ETCETERA

Rest of markdown document

I suppose it it possible to assume that the first block of text before any blank lines is a code block, but this strikes me as an odd choice.

@nicholasserra
Copy link
Collaborator

Ah, gotcha. That change came in on purpose, via #215

So I'd say we respect it moving forward, if possible.

@davidlowryduda
Copy link
Contributor Author

Ok. I'd missed that. I'll update the fix to keep that, and I'll update the documentation.

The previous commit towards resolving Issue trentm#234 didn't incorporate
previous behavior that fences shouldn't be necessary. First introduced
in Pull Request trentm#215, metadata should be accessible even without
including `---` fences around opening metadata.

This fix now preserves the ability to use either `---` fences (maybe
without a subsequent blank line) or no fences (but with a blank line).

Resolves: trentm#234
@davidlowryduda
Copy link
Contributor Author

davidlowryduda commented Dec 20, 2016

I've completed the update, and I cleared merge conflicts. I'm happy to say all checks now pass.

I'd like to note one thing about the change, which is that it isn't necessary for there to be an empty line after a fenced metadata opening [as evident in the metadata1 test]. However, this is the defining characteristic of metadata if no fences are used. So It is necessary to check for fences, and then either handle the fenced metadata (if there are fences) or look for the first linebreak (if there are no fences).

@nicholasserra
Copy link
Collaborator

Looks good to me. Thank you for the work on this.

@nicholasserra nicholasserra merged commit d147cf9 into trentm:master Dec 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants