Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make metadata fences optional #215

Merged
merged 1 commit into from
Jun 20, 2016
Merged

make metadata fences optional #215

merged 1 commit into from
Jun 20, 2016

Conversation

nkanaev
Copy link
Contributor

@nkanaev nkanaev commented Jun 19, 2016

Markdown package supports parsing metadata without mandatory "---"-wrapping. The fix enables to write metadata like this:

some: metadata
other: stuff

# here starts usual content

so the top metadata can be separated by a single blank line.

@nicholasserra
Copy link
Collaborator

So this fix just allows metadata to be included without the hyphens wrapped around it? Is it still enforced that the metadata is at the top? Looks like yes.

@nkanaev
Copy link
Contributor Author

nkanaev commented Jun 20, 2016

Yes, hyphens become optional. The regex still searches at the top of the text.

@nicholasserra nicholasserra merged commit c5fe8f2 into trentm:master Jun 20, 2016
@nicholasserra
Copy link
Collaborator

Thanks :D

davidlowryduda added a commit to davidlowryduda/python-markdown2 that referenced this pull request Dec 20, 2016
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
nicholasserra pushed a commit that referenced this pull request Dec 20, 2016
* Fix metadata extra to consume only initial fenced block

As noted in Issue #234

  #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: #234

* Add David Lowry-Duda as a contributor

* Updated fix on metadata to work without fences

The previous commit towards resolving Issue #234 didn't incorporate
previous behavior that fences shouldn't be necessary. First introduced
in Pull Request #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: #234
nicholasserra pushed a commit that referenced this pull request Mar 7, 2017
* Fix metadata extra to consume only initial fenced block

As noted in Issue #234

  #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: #234

* Add David Lowry-Duda as a contributor

* Updated fix on metadata to work without fences

The previous commit towards resolving Issue #234 didn't incorporate
previous behavior that fences shouldn't be necessary. First introduced
in Pull Request #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: #234

* Add language support for footnotes

As noted in Issue #244, it is not currently possible to customize the
text used in footnotes. It is always "Jump back to footnote <number> in
the text." It may be desirable to provide a programmable way to supply
different text, such as in different languages.

This provides that support when used from within the interpreter. Usage
is

    markdowner = markdown2.Markdown(extras=["footnotes"])
    markdowner.footnote_title = "Retournez vers footnote %d. "
    markdowner.convert(text)

This also adds the ability to change the footnote link text, through

    markdowner.footnote_link_text = "<something>"

because they are very similar.

Resolves: #244

* Added footenoteBackLink class to footnotes

* Make user-provided backlinks for custom footnotes more natural

Users no longer need to include html closing tags in custom definitions
for footnote_title or footnote_link_text. And naked except Exception
statements have been replaced with the expected errors. These notes were
made by nicholasserra in Pull Request #247

* "title=" no longer required for custom footnote title

* Added ability to provide custom class variables to Markdown instance

It is now possible to provide class variables to the Markdown instance
in the testing library by creating a file.customargs file containing a
dictionary.

For example, one might have have a footnotes_customtitle test, which
could be tested by making the following file.

footnotes_customtitle.customargs
---
{"footnote_title" : "Return to %d above"}
---

When testing footnote_customtitle, the Markdown instance will be passed
the variable, essentially like

```
markdowner = markdown2.Markdown(*opts)
markdowner.footnote_title = "Return to %d above"
text = markdowner.convert(html)
```

This was done to allow tests for #247

* Added missing quotes to footnote_titles

* Added test for custom footnote_title to test suite

There is now a test for custom footnote_titles in the test suite.

Adds tests for: PR #247
Resolves: #244

* Change custom footnotes to function inline

The behavior of custom footnote text is now implemented in the following
way, as recommended in #247

```
markdown2.markdown(text, extras=["footnotes"],
                   footnote_title="Regresar a %d.")
```

This is in contrast to the previous implementation, which required an
intermediate step defining a class variable. As the interface changed,
it was necessary to rewrite the relevant test, which now defines the
customization in the footnotes_custom.opts file.
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