项目作者: tategakibunko

项目描述 :
nehan plugin for preview anchor link
高级语言: TypeScript
项目地址: git://github.com/tategakibunko/nehan-anchor.git
创建时间: 2021-03-13T07:51:48Z
项目社区:https://github.com/tategakibunko/nehan-anchor

开源协议:MIT License

下载


nehan-anchor

nehan plugin for preview anchor link.

create nehan style

  1. import { Anchor, PagedNehanDocument, CssStyleSheet } from 'nehan';
  2. import * as AnchorStyle from 'nehan-anchor';
  3. const anchorStyle: CssStyleSheet = AnchorStyle.create({
  4. previewSpacing: 10,
  5. onClickAnchorLink(anchor: Anchor){
  6. console.log("click anchor:", anchor);
  7. }
  8. });
  9. const pd = new PagedNehanDocument("<blockquote id="bq1">foo</blockquote><a href="#bq1">hover</a>", {
  10. styleSheets:[
  11. anchorStyle, // add anchor style!
  12. ]
  13. });

use markup

  1. <blockquote id="bq1">some blockquoted text with id attribute</blockquote>
  2. And you can preview it by creating anchor link like <a href="#bq1">this</a>.