make metadata fences optional by nkanaev · Pull Request #215 · trentm/python-markdown2

@nkanaev

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.