defrancea / Projbook

Generate project documentation using Markdown and allow integrating code snippet from the source code being built. Code snippet are always up-to-date.
https://www.nuget.org/packages/Projbook
Other
15 stars 10 forks source link

Fix #10 Add ligne highlighting #97

Closed timotheehub closed 8 years ago

timotheehub commented 8 years ago

Syntax highlighting with prism.js and data-lines

defrancea commented 8 years ago

Pointing lines from their absolute number is not enough because it would be weak at snippets refactoring and thus defeat the purpose of Projbook.

The right approach is:

  1. Extend snippet data structure to contain line pointer
  2. During snippet extraction:
    • Define flags in comments depending on snippet syntax
    • Detect flags and build line pointer from them
    • Wipe flags from snippets
    • Render line pointer during plain text snippet rendering

Prototype here: https://github.com/defrancea/Projbook/commit/197d41ccfdd0a8b9426d427100265624a32adfe3