Code Monkey home page Code Monkey logo

heading-anchors-publish-plugin's Introduction

Heading Anchors for Publish

Add anchor links to your headings so you can easily share them or let your users share them with others.

Installation

To install it into your Publish package, add it as a dependency within your Package.swift manifest:

let package = Package(
  dependencies: [
    .package(name: "HeadingAnchors", url: "https://github.com/markbattistella/heading-anchors-publish-plugin", from: "1.0.0")
  ],
  targets: [
    .target(
      dependencies: [
        "HeadingAnchors"
	  ]
	)
  ]
)

Then import HeadingAnchors wherever you’d like to use it:

import HeadingAnchors

For more information on how to use the Swift Package Manager, check out its official documentation.

Usage

The plugin can then be used within any publishing pipeline like this:

import HeadingAnchors

try DeliciousRecipes().publish(using: [
  ...
  .installPlugin(.addHeadingAnchors())
  ...
])

By default it will add in the default CSS files from the plugin to help style your components.

However if you wish to add your own in your main CSS file, install the plugin by:

import ExtraComponents

try DeliciousRecipes().publish(using: [
  .installPlugin(.addHeadingAnchors(addCSS: false))
])

You will have to add the CSS file into your Stylesheets array in your custom theme.

There are other options too avaialble.

Parameter Type Usage
upto: Int Determines which heading tags should get anchor links. It starts at <h1> and the number you put tells the loop where to stop. Example, entering 4 will mean all <h1>, <h2>, <h3>, and <h4> will get anchor links, but <h5> and <h6> will not.
icon: Icon Select from the 14 icons which you can use to have as the anchor link
addCSS: Bool Whether the predefined CSS will be added into your Output folder
path: Path Select where in the Output folder your CSS file will be written to if using the default CSS

Contributing

I've turned off Issues and if you wish to add/change the codebase please create a Pull Request.

This way everyone can allow this plugin to grow, and be the best rather than waiting on me to write it.

How to help

  1. Clone the repo: git clone https://github.com/markbattistella/heading-anchors-publish-plugin
  2. Create your feature branch: git checkout -b my-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit the pull request

SVG icons

There are 14 anchor icons you can select to have next to your headings:

SVG enum Selection
link
hash
bookmark
bookmarkFilled
dot
dotFilled
flame
heart
heartFilled
external
northStar
book
star
starFilled

heading-anchors-publish-plugin's People

Contributors

markbattistella avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.