This repository has been archived by the owner on Apr 4, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f910a11
Showing
18 changed files
with
604 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
; This file is for unifying the coding style for different editors and IDEs. | ||
; More information at http://editorconfig.org | ||
|
||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_size = 4 | ||
indent_style = space | ||
end_of_line = lf | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Path-based git attributes | ||
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html | ||
|
||
# Ignore all test and documentation with "export-ignore". | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.scrutinizer.yml export-ignore | ||
/.travis.yml export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/scrutinizer.yml export-ignore | ||
/tests export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/.idea/ | ||
/build/ | ||
/composer.lock | ||
/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
filter: | ||
excluded_paths: [tests/*] | ||
|
||
checks: | ||
php: | ||
code_rating: true | ||
remove_extra_empty_lines: true | ||
remove_php_closing_tag: true | ||
remove_trailing_whitespace: true | ||
fix_use_statements: | ||
remove_unused: true | ||
preserve_multiple: false | ||
preserve_blanklines: true | ||
order_alphabetically: true | ||
fix_php_opening_tag: true | ||
fix_linefeed: true | ||
fix_line_ending: true | ||
fix_identation_4spaces: true | ||
fix_doc_comments: true | ||
|
||
tools: | ||
external_code_coverage: | ||
timeout: 600 | ||
runs: 3 | ||
php_analyzer: true | ||
php_code_coverage: false | ||
php_code_sniffer: | ||
config: | ||
standard: PSR2 | ||
filter: | ||
paths: ['src'] | ||
php_cpd: | ||
enabled: true | ||
excluded_dirs: [vendor, tests] | ||
php_loc: | ||
enabled: true | ||
excluded_dirs: [vendor, tests] | ||
php_pdepend: true | ||
php_sim: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
preset: recommended | ||
|
||
enabled: | ||
- concat_with_spaces | ||
- strict | ||
|
||
disabled: | ||
- concat_without_spaces | ||
- phpdoc_summary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
language: php | ||
|
||
php: | ||
- 5.6 | ||
- 7.0 | ||
- 7.1 | ||
- 7.2 | ||
- 7.3 | ||
|
||
env: | ||
matrix: | ||
- COMPOSER_FLAGS="" | ||
- COMPOSER_FLAGS="--prefer-stable --prefer-lowest" | ||
|
||
sudo: false | ||
|
||
before_script: | ||
- travis_retry composer self-update | ||
- travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source | ||
|
||
script: | ||
- vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover | ||
|
||
after_script: | ||
- wget https://github.com/scrutinizer-ci/ocular/releases/download/1.5.2/ocular.phar | ||
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Changelog | ||
|
||
All notable changes will be documented in this file. | ||
|
||
## [Unreleased][unreleased] | ||
|
||
## 0.1.0 - 2019-03-11 | ||
|
||
Initial release! | ||
|
||
[unreleased]: https://github.com/thephpleague/commonmark-ext-inlines-only/compare/0.1.0...HEAD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Contributor Code of Conduct | ||
|
||
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. | ||
|
||
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality. | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery | ||
* Personal attacks | ||
* Trolling or insulting/derogatory comments | ||
* Public or private harassment | ||
* Publishing other's private information, such as physical or electronic addresses, without explicit permission | ||
* Other unethical or unprofessional conduct. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team. | ||
|
||
This code of conduct applies both within project spaces and in public spaces when an individual is representing the project or its community in a direct capacity. Personal views, beliefs and values of individuals do not necessarily reflect those of the organisation or affiliated individuals and organisations. | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Contributing | ||
|
||
Contributions are **welcome** and will be fully **credited**. | ||
|
||
We accept contributions via Pull Requests on [Github](https://github.com/thephpleague/commonmark-ext-inlines-only). | ||
|
||
## Pull Requests | ||
|
||
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). | ||
|
||
- **Add tests!** - Your patch won't be accepted if it doesn't have tests. | ||
|
||
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. | ||
|
||
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. | ||
|
||
- **Create feature branches** - Don't ask us to pull from your master branch. | ||
|
||
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. | ||
|
||
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting. | ||
|
||
- **Docblocks** - All files should start with the following docblock: | ||
|
||
~~~ | ||
/* | ||
* This file is part of the league/commonmark-ext-inlines-only package. | ||
* | ||
* (c) Colin O'Dell <[email protected]> | ||
* | ||
* Authored by Your Name <[email protected]> | ||
* | ||
* Original code based on the CommonMark JS reference parser (http://bitly.com/commonmark-js) | ||
* - (c) John MacFarlane | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
~~~ | ||
|
||
The "Authored by" line is optional. | ||
|
||
|
||
## Running Tests | ||
|
||
``` bash | ||
$ composer test | ||
``` | ||
|
||
|
||
**Happy coding**! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Copyright (c) 2014-2019, Colin O'Dell | ||
|
||
Portions of this code based on commonmark.js: Copyright (c) 2014-2016, John MacFarlane | ||
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following | ||
disclaimer in the documentation and/or other materials provided | ||
with the distribution. | ||
|
||
* Neither the name of Colin O'Dell nor the names of other | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Inline-only extension for `league/commonmark` | ||
|
||
[![Latest Version on Packagist][ico-version]][link-packagist] | ||
[![Software License][ico-license]](LICENSE.md) | ||
[![Build Status][ico-travis]][link-travis] | ||
[![Coverage Status][ico-scrutinizer]][link-scrutinizer] | ||
[![Quality Score][ico-code-quality]][link-code-quality] | ||
[![Total Downloads][ico-downloads]][link-downloads] | ||
|
||
This extension configures the [`league/commonmark` Markdown parser for PHP](https://github.com/thephpleague/commonmark) to only render inline elements - no paragraph tags, headers, code blocks, etc. | ||
|
||
## Install | ||
|
||
Via Composer | ||
|
||
``` bash | ||
$ composer require league/commonmark-ext-inlines-only | ||
``` | ||
|
||
## Usage | ||
|
||
Although you normally add extra extensions to the default core one, we're not going to do that here, because this is essentially a slimmed-down version of the core extension: | ||
|
||
``` php | ||
use League\CommonMark\CommonMarkConverter; | ||
use League\CommonMark\Environment; | ||
use League\CommonMark\Ext\InlinesOnly\InlinesOnlyExtension; | ||
|
||
// Create a new, empty environment | ||
$environment = new Environment(); | ||
|
||
// Add this extension | ||
$environment->addExtension(new InlinesOnlyExtension()); | ||
|
||
// Instantiate the converter engine and start converting some Markdown! | ||
$converter = new CommonMarkConverter($config, $environment); | ||
echo $converter->convertToHtml('**Hello World!**'); | ||
``` | ||
|
||
## Changelog | ||
|
||
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently. | ||
|
||
## Testing | ||
|
||
``` bash | ||
$ composer test | ||
``` | ||
|
||
## Security | ||
|
||
If you discover any security related issues, please email [email protected] instead of using the issue tracker. | ||
|
||
## Credits | ||
|
||
- [Colin O'Dell][link-author] | ||
- [John MacFarlane][link-jgm] | ||
- [All Contributors][link-contributors] | ||
|
||
## License | ||
|
||
This library is licensed under the BSD-3 license. See the [License File](LICENSE.md) for more information. | ||
|
||
[ico-version]: https://img.shields.io/packagist/v/league/commonmark-ext-inlines-only.svg?style=flat-square | ||
[ico-license]: http://img.shields.io/badge/License-BSD--3-brightgreen.svg?style=flat-square | ||
[ico-travis]: https://img.shields.io/travis/thephpleague/commonmark-ext-inlines-only/master.svg?style=flat-square | ||
[ico-scrutinizer]: https://img.shields.io/scrutinizer/coverage/g/thephpleague/commonmark-ext-inlines-only.svg?style=flat-square | ||
[ico-code-quality]: https://img.shields.io/scrutinizer/g/thephpleague/commonmark-ext-inlines-only.svg?style=flat-square | ||
[ico-downloads]: https://img.shields.io/packagist/dt/league/commonmark-ext-inlines-only.svg?style=flat-square | ||
|
||
[link-packagist]: https://packagist.org/packages/league/commonmark-ext-inlines-only | ||
[link-travis]: https://travis-ci.org/thephpleague/commonmark-ext-inlines-only | ||
[link-scrutinizer]: https://scrutinizer-ci.com/g/thephpleague/commonmark-ext-inlines-only/code-structure | ||
[link-code-quality]: https://scrutinizer-ci.com/g/thephpleague/commonmark-ext-inlines-only | ||
[link-downloads]: https://packagist.org/packages/league/commonmark-ext-inlines-only | ||
[link-author]: https://github.com/colinodell | ||
[link-contributors]: ../../contributors | ||
[link-league-commonmark]: https://github.com/thephpleague/commonmark | ||
[link-jgm]: https://github.com/jgm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "league/commonmark-ext-inlines-only", | ||
"type": "commonmark-extension", | ||
"description": "Extension for league/commonmark which only renders inline text", | ||
"keywords": ["markdown", "commonmark", "extension", "inline"], | ||
"homepage": "https://github.com/thephpleague/commonmark-ext-inlines-only", | ||
"license": "BSD-3-Clause", | ||
"authors": [ | ||
{ | ||
"name": "Colin O'Dell", | ||
"email": "[email protected]", | ||
"homepage": "https://www.colinodell.com", | ||
"role": "Lead Developer" | ||
} | ||
], | ||
"require": { | ||
"php" : ">=5.6", | ||
"league/commonmark": "^0.18.1" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^5.7" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"League\\CommonMark\\Ext\\InlinesOnly\\": "src" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"league\\CommonMark\\Ext\\InlinesOnly\\Test\\": "tests" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "phpunit" | ||
}, | ||
"extra": { | ||
"branch-alias": { | ||
"dev-master": "0.2-dev" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit bootstrap="vendor/autoload.php" | ||
backupGlobals="false" | ||
backupStaticAttributes="false" | ||
colors="true" | ||
verbose="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
processIsolation="false" | ||
stopOnFailure="false"> | ||
<testsuites> | ||
<testsuite name="commonmark-ext-inlines-only Test Suite"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">src/</directory> | ||
</whitelist> | ||
</filter> | ||
<logging> | ||
<log type="tap" target="build/report.tap"/> | ||
<log type="junit" target="build/report.junit.xml"/> | ||
<log type="coverage-html" target="build/coverage" charset="UTF-8" yui="true" highlight="true"/> | ||
<log type="coverage-text" target="build/coverage.txt"/> | ||
<log type="coverage-clover" target="build/logs/clover.xml"/> | ||
</logging> | ||
</phpunit> |
Oops, something went wrong.