项目作者: azu

项目描述 :
Map rendered text/html position to Markdown position.
高级语言: TypeScript
项目地址: git://github.com/azu/position-map-text-to-markdown.git
创建时间: 2017-05-28T05:51:39Z
项目社区:https://github.com/azu/position-map-text-to-markdown

开源协议:MIT License

下载


position-map-text-to-markdown

Map rendered text/html position to Markdown position.

  • Find the original position in Markdown from html text.

Install

Install with npm:

  1. npm install position-map-text-to-markdown

Usage

  1. import {findAllPositions} from "position-map-text-to-markdown";
  2. const results = findAllPositions({
  3. text: "match",
  4. markdown: "**match** __match__"
  5. });
  6. assert.ok(results.length === 2);
  7. const [result1, result2] = results;
  8. assert.deepEqual(result1, {
  9. markdown: "match",
  10. range: [2, 7],
  11. loc: {
  12. start: { line: 1, column: 2 },
  13. end: { line: 1, column: 7 }
  14. }
  15. });
  16. assert.deepEqual(result2, {
  17. markdown: "match",
  18. range: [12, 17],
  19. loc: {
  20. start: { line: 1, column: 12 },
  21. end: { line: 1, column: 17 }
  22. }
  23. });

Changelog

See Releases page.

Running tests

Install devDependencies and Run npm test:

  1. npm i -d && npm test

Contributing

Pull requests and stars are always welcome.

For bugs and feature requests, please create an issue.

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

License

MIT © azu