Commit graph

177 commits

Author SHA1 Message Date
Daniel Andersson
6e1f4abba0 Handle quotes in alt texts
A bit of a brute force solution, but the parser splits the attribute
upon encountering a quote into multiple nodes. Walk through them,
collect strings and drop them from further parsing.
2019-04-07 00:17:16 +02:00
Daniel Andersson
816fc608e6 Add test cases for quotes in alt texts 2019-04-07 00:16:58 +02:00
Daniel Andersson
059e95d6f3 Use image description text as "alt", drop title
The current RecommonMark specification on images [0] says that:

    ![foo](/url "title")

should render as

    <p><img src="/url" alt="foo" title="title" /></p>

which means that "foo" should be the `alt` attribute, and "title" should
be the `title` attribute.

Currently, `recommonmark` will:

1. set the `alt` attribute to "title"
2. render "foo" as literal text following the image element.

Neither yields results in line with the RecommonMark standard, resulting
in the following when transformed to HTML:

    <p><img src="/url" alt="title" />foo</p>

While it might be surprising that `alt` is set to "title", the more
pressing issue is how the alt text becomes literal text within the
paragraph, typically not rendering well.

This commit instead makes `recommonmark`:

1. set the `alt` attribute to "foo"
2. drop "title" altogether since the `title` attribute is not supported
   in Docutils [1].

1 coincides with the specification, and 2 is in my mind the least
surprising solution within the capabilities of Docutils. The HTML will
now be:

    <p><img src="/url" alt="foo" /></p>

only differing in the missing `title` attribute when compared to the
specification.

[0]: https://spec.commonmark.org/0.28/#images
[1]: http://docutils.sourceforge.net/docs/ref/rst/directives.html#image
2019-04-06 12:56:27 +02:00
Eric Holscher
815d75ea50
Merge pull request #147 from loganrosen/patch-1
Bump dependency on commonmark to >= 0.8.1
2019-03-19 10:01:00 -03:00
Logan Rosen
150311c844
Bump dependency on commonmark to >= 0.8.1
In #118, there was a change made to rename all commonmark imports from `commonmark` to `CommonMark` due to a breaking change to the package name in that dependency in version 0.8.1. However, the dependency on `commonmark` wasn't updated, which means that people pulling in commonmark >= 0.7.3 and < 0.8.1 are experiencing issues while using recommonmark. This updates the versioned dependency accordingly to resolve this issue.
2019-03-18 20:52:17 -04:00
Eric Holscher
7d7d5d0b88
Merge pull request #140 from codejamninja/codejamninja/gitignore
Use official gitignore template
2019-02-22 10:49:57 -03:00
Eric Holscher
caeff7e9b5
Update .gitignore 2019-02-22 10:49:50 -03:00
Jam Risser
25019a4810 Use official gitignore template 2019-02-04 14:27:11 -06:00
Eric Holscher
589d25994a
Merge pull request #128 from dotlambda/patch-1
Include all test files in PyPI tarball
2019-01-14 09:59:13 -05:00
Robert Schütz
8e02e8309a
Include all test files in PyPI tarball 2019-01-14 14:52:21 +01:00
Eric Holscher
f79c2bf616 Release 0.5 2019-01-08 16:45:59 -05:00
Eric Holscher
eebb02c77a
Merge pull request #126 from molpako/fix-contents-directive
Fix contents directive
2019-01-02 19:27:06 -05:00
molpako
e53321e713 add a last line 2018-12-31 19:43:40 +09:00
molpako
34f3352135 add test 2018-12-31 19:38:28 +09:00
molpako
0183db8365 fix contents directive 2018-12-19 15:47:08 +09:00
Eric Holscher
fdeeda5f6f
Merge pull request #125 from rtfd/update-tox
Run travis against multiple sphinx versions
2018-10-12 13:55:47 +02:00
Eric Holscher
72563901b7 Run against latest for lint/docs 2018-10-12 11:42:45 +02:00
Eric Holscher
fe2974f127 Attempt to fix tox ini 2018-10-12 11:30:22 +02:00
Eric Holscher
0440308592 Run travis against multiple sphinx versions 2018-10-12 10:54:50 +02:00
Eric Holscher
a0afe7d383
Merge pull request #123 from rtfd/fix-docs-urls
Fix TOCTree not linking properly
2018-10-11 16:54:42 +02:00
Eric Holscher
32255dc308 Fix TOCTree not linking properly 2018-10-11 16:46:28 +02:00
Eric Holscher
298caf6462
Merge pull request #122 from Anntoin/master
Add visit_html_block
2018-10-09 16:58:15 +02:00
Anntoin Wilkinson
be55a6de90 Add visit_html_block
Without this any html_block nodes processed by the parser are dropped.
`visit_html_block` uses the existing logic for `visit_html_inline`.

Added a test case to check html_blocks are parsed as expected.

Fixes: https://github.com/rtfd/recommonmark/issues/121
2018-10-08 20:17:02 +01:00
Eric Holscher
9c15d32547
Merge pull request #118 from vvfesik/master
rename `CommonMark` to `commonmark`
2018-10-06 17:55:56 +02:00
Vasyl Fesik
a38bac33b7 rename CommonMark to commonmark in tests 2018-09-17 16:16:57 +03:00
Vasyl Fesik
06300d0873 rename CommonMark to commonmark 2018-09-10 14:23:08 +03:00
Eric Holscher
33b5c2a4ec
Merge pull request #115 from tswast/patch-1
Update package version to 0.5.0.dev
2018-09-07 17:24:28 +02:00
Eric Holscher
51b7f77e13
Merge pull request #113 from tk0miya/use_new_Sphinx_API
Register a parser class using new Sphinx API; add_source_suffix
2018-09-07 17:24:21 +02:00
Eric Holscher
a312543fc6
Merge pull request #111 from ttmc/patch-1
Add more metadata to setup.py for PyPI
2018-08-22 14:08:22 +02:00
Tim Swast
dbe109149e
Update package version
Clearly there have been many changes since 0.4.0. I propose the next release be 0.5.0. In the meantime, by adding a [development release separator](https://www.python.org/dev/peps/pep-0440/#development-release-separators) pip will more clearly indicate the package version for those installing via git.
2018-08-08 10:50:58 -07:00
Takeshi KOMIYA
029c649065 Register a parser class using new Sphinx API; add_source_suffix 2018-07-28 18:14:42 +09:00
Troy McConaghy
fab0218efb
Add more metadata to setup.py for PyPI
Add a description, URL and license to `setup.py` so [the recommonmark package page on PyPI](https://pypi.org/project/recommonmark/) will include that information.
2018-07-24 12:17:09 +02:00
Eric Holscher
956bf18b24
Merge pull request #102 from FireflyTeam/add-translate-section-name
Add section name translate support
2018-05-30 15:59:43 -04:00
Eric Holscher
4f6a53ac3b
Merge pull request #101 from FireflyTeam/fix-bold-link
Fix exception with link inside bold/italic
2018-05-30 15:58:52 -04:00
Eric Holscher
5f4bd644a6
Merge pull request #99 from rtfd/split-lint
Stop linting since there's a lot of errors for now.
2018-05-30 15:51:28 -04:00
Eric Holscher
0cf3a3aea3 Newer sphinx 2018-05-30 15:48:39 -04:00
djw
63f25d2a71 Add section name translate support
When section name is not written in ASCII, the ID of the section will be
generated by default, in the form of 'id<unique number>'. This is no good
writing links to other document, whose ID are subject to change in adding
or removing sections.

Adding a `translate_section_name` filter in Parser will allow user to install
a customized one to translate the section name into more readable one. For
example, convert the Chinese section name to more ASCII-friendly pinyin.
2018-05-07 17:41:03 +08:00
djw
dd15581df1 Fix exception with link inside bold/italic
Return default line number of 0 when no sourcepos found.

Fixes #100
2018-05-07 17:24:07 +08:00
Eric Holscher
31e4cdcd4b Continue running docs 2018-04-27 09:36:51 -07:00
Eric Holscher
7e15d3823c Stop linting since there's a lot of errors for now. 2018-04-27 09:33:14 -07:00
Eric Holscher
450909bdcf
Merge pull request #91 from kbenzie/kbenzie/fix_md_links
Fix hard error on cross-linking markdown document
2018-04-27 09:15:27 -07:00
Eric Holscher
3238b029b6
Merge pull request #95 from choldgraf/patch-1
Updating autostructify links in readme
2018-02-16 14:01:44 +07:00
Chris Holdgraf
25db3cb68d
Updating autostructify links in readme
The links are hard to find, so this makes them more discoverable
2018-02-10 08:41:14 -08:00
Kenneth Benzie (Benie)
7762ab3888 Fix hard error on cross-linking markdown document
Sphinx 1.6.5 with tip recommonmark hard errors when a markdown document
contains a cross-reference to another local markdown document as it
unconditionally access the `refdomain` of a `pending_xref`. This was
fixed [elsewhere](https://github.com/ignatenkobrain/sphinxcontrib-issuetracker/pull/13/files#diff-61beda6e59ec3020dbf0c2826dbb64c4R161)
by setting it to `None`. This patch uses the same approach which no
longer causes the Sphinx build to fail on cross-linking a markdown
document however the generated link is not correctly rendered producing
broken links in the generated html.

Addressing the broken links, the `mdnode.destination` is stripped of its
file extension if that extension is supported by `CommonMarkParser`
however this will only work for markdown documents, not ReStructuedText
or any other extended file type parsers.

Fixes #89.
2017-11-02 16:46:27 +00:00
Anthony
c410abb565 Merge pull request #63 from rtfd/commonmark-0.7.3
Update to support CommonMark >= 0.7.3 and clean up code
2017-05-03 15:30:47 -07:00
Anthony Johnson
e62f4039ea
Add missing inline code parsing 2017-03-23 14:13:47 -07:00
Anthony Johnson
bdd12f9bbc
Lint fix 2017-03-03 01:35:52 -08:00
Anthony Johnson
e30cd3f894
Fix py3 urllib call 2017-03-03 01:31:05 -08:00
Anthony Johnson
8baf238562
Fix linking, add tests, fix auto toc, deprecate and remove auto ref
This fixes link nesting, and resolves some issues around links not closing
correctly. There were a few changes required to support the autotoc feature, and
the auto ref feature has be deprecated. This feature no longer is required, as
we are doing pending_xref natively. The functionality was breaking Sphinx
altogether, so it doesn't make sense to keep it and deprecate the feature.
2017-03-03 01:20:23 -08:00
Anthony Johnson
1f7f525c7b
Port in pending_xref node changes to references
* Moves changes from #61 into this PR
* Drops basic testing from #61
* Adds to implementation pending_xref back down to reference

The implementation in #61 breaks a number of cases, like "/example" and
"example.html", etc. Instead of trying to enumerate case we want an xref instead
of a pending_xref, just pin the xref on the pending_xref to back down.
pending_xref replaces itself with it's children if the reference isn't resolved.
2017-03-02 20:04:30 -08:00