Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include changes from other PRs, resolving conflicts #22

Merged
merged 30 commits into from
Oct 18, 2020

Conversation

rnorth
Copy link
Owner

@rnorth rnorth commented Oct 18, 2020

Indent the ellipsis between non-adjacent lines (#15)

Use the last line indent so that the result can be
un-indented by the caller. It prevents results like this:

    /* block 1 */
...
    /* block 2 */

turning them into

    /* block 1 */
    ...
    /* block 2 */

which will be dedented by the caller.

Allow selectors on next line (#10)

Allows targeting expressions to be on the next line:

<!--codeinclude-->
<!-- On the same line -->
[Title](long/long/Path) targeting_expr1

<!-- On the next line -->
[Title2](long/long/Path)
targeting_expr2
<!--/codeinclude-->

I kept the usage of a regular expression to find the include definitions, but had to change the implementation to use re.findall and a multiline expression instead of re.match over a single line.

The processing is now separated into three stages:

  1. Code-include block extraction.
  2. Computing substitutes (patches) for each block.
  3. Application of patches to the original markdown.

Resolves #9

Fix inside_block inclusion with multiple curly brackets on the same line (#14)

Add support for any language (#5)

Auto-detect the source language and the alias to use using the Pygments API.

Allow empty titles (#6)

Allow empty title for code snippets. It may be useful for short code fragments.

dmitry-timofeev and others added 30 commits February 14, 2020 19:21
Use the file extension as the language class for
highlight.js appears to support file extensions as language
classes, see: https://github.com/highlightjs/highlight.js#supported-languages
It must be more accurate than the file extension.
Allow empty title for code snippets. It may
be useful for short code fragments.
Always use UTF-8 as it is commonly used
for platform-independent source files.
The fix in 2979ea4
was incomplete: see the added tests.
Use the last line indent so that the result can be
un-indented by the caller. It prevents results like this:

```
    /* block 1 */
...
    /* block 2 */
```

turning them into

```
    /* block 1 */
    ...
    /* block 2 */
```

which will be dedented by the caller.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow targeting expr on the next line
2 participants