https://github.com/SpinalCMS/bridgetown-internal-markdown-links
Parse internal links in markdown files
https://github.com/SpinalCMS/bridgetown-internal-markdown-links
bridgetown bridgetown-plugin bridgetownrb
Last synced: about 1 month ago
JSON representation
Parse internal links in markdown files
- Host: GitHub
- URL: https://github.com/SpinalCMS/bridgetown-internal-markdown-links
- Owner: SpinalCMS
- License: mit
- Created: 2023-03-11T13:37:23.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-26T18:22:46.000Z (over 1 year ago)
- Last Synced: 2024-04-25T11:42:20.921Z (12 months ago)
- Topics: bridgetown, bridgetown-plugin, bridgetownrb
- Language: Ruby
- Homepage: https://spinalcms.com/cms-for-bridgetown/
- Size: 10.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# đź”— Bridgetown Internal Markdown links
This plugin allows you to write paths in your markdown similar to how you can within liquid, serbea or erb template files, like so:
`[Check out the docs](_pages/docs.erb)`
Instead of:
`[Check out the docs](/docs/)`
(and do a find/replace throughout your site, if the slug changes for that page).
This plugin uses Bridgetown's `url_for()` helper in the background.
## Installation
Run this command to add this plugin to your site's Gemfile:
```shell
bundle add bridgetown_internal_markdown_links
```Then add the initializer to your configuration in `config/initializers.rb`:
```ruby
init :bridgetown_internal_markdown_links
```## Usage
Link parsing is opt-in per collection.
### Configuration
Add the following in your `config/initializers.rb`:
```ruby
config.internal_markdown_links.collections = ["posts", "docs"]
```Parsing of internal links is now happening for the collections “posts” and “docs”.
### Disable per file
Set `internal_markdown_links: false` in the frontmatter.
## Testing (TBD)
* Run `bundle exec rake test` to run the test suite
* Or run `script/cibuild` to validate with Rubocop and Minitest together.## Sponsored By [Spinal](https://spinalcms.com/cms-for-bridgetown/)
## Contributing
1. Fork it (https://github.com/SpinalCMS/bridgetown-internal-markdown-links/fork)
2. Clone the fork using `git clone` to your local development machine.
3. Create your feature branch (`git checkout -b my-new-feature`)
4. Commit your changes (`git commit -am 'Add some feature'`)
5. Push to the branch (`git push origin my-new-feature`)
6. Create a new Pull Request