Commit Graph

29 Commits

Author SHA1 Message Date
Tim Allen
0a4a9f1c3d Markdown inline formatting should not span paragraphs.
Previously, two underscore characters in a document would mark the entire
space between them as italic, no matter how far apart. Now we only accept a
single consecutive newline within an inline-formatted span, so hard-wrapped
documents will still format nicely but stray characters won't mess up your
entire document.

Note that the highlighter for backtick-enclosed spans was modified,
even though it's redundant with the code-block highlighting introduced
in 5bc62c694.
2018-03-15 18:26:20 +11:00
Tim Allen
78f1e1ca98 Highlight footnote-style hyperlinks.
As well as the traditional `[text](url)` syntax, Markdown allows the text to
be followed by a tag in square brackets. If the text is followed by nothing
at all, then the tag for that link is the text itself. The actual URL
is supplied later in the document, like a footnote at the bottom of the page:

	Some text with [a link][tag] and [another link].

	[tag]: http://www.example.com/link1
	[another link]: http://www.example.com/link2

This adds the "link" face to the URL in such footnote lines.
2018-03-15 18:16:47 +11:00
Dan Rosén
969f416027 Generate the markdown highlighter code 2017-12-13 07:27:45 +01:00
Dan Rosén
5bc62c6942 Fix highlight references in Markdown fenced code blocks
Fixes #1735

We need \K to not interfer with languages own interpretation of ` like multiline strings in javascript

We need \b in e.g. java\b otherwise it blocks javascript

I couldn't get the bare ``` to not block the other highlighters when introducing \K any other way than negative lookahead of all possible highlighers
2017-12-10 23:00:26 +01:00
LeRoyce Pearson
3acf3aa5a2 Fix overlapping inline markup
Make it some some text like "**bold**" wil not be marked as italic and bold.
2017-12-08 16:04:43 -06:00
Frank LENORMAND
9127ed0d55 src rc: Rename exec/eval into execute-keys/evaluate-commands 2017-11-03 11:09:45 +03:00
Frank LENORMAND
c9b280b712 rc: Don't use command aliases to highlight keywords properly 2017-11-03 10:34:41 +03:00
Maxime Coste
d49555fc75 Move highlighters into Scopes
That means we can now have highlighters active at global, buffer, and
window scope. The add-highlighter and remove-highlighter syntax changed
to take the parent path (scope/group/...) as a mandatory argument,
superseeding the previous -group switch.
2017-10-28 13:43:04 +08:00
Maxime Coste
591ddb86e3 markdown.kak: Remove fenced block support from
Its not in the spec, except for code blocks that we handle differently
anyway. More importantly it currently relies on backreference.
2017-10-25 10:29:11 +08:00
Maxime Coste
0fa59e5fd2 rc/: Tweak some regexes to be compatible with our impl limitations
The upcoming custom implementation does not support arbitrary lookarounds,
and other advanced regex features. Simplify the regexes to avoid those.
2017-10-25 10:27:39 +08:00
Tim Allen
e640e6d859 Consecutive markdown list bullets are not a valid list prefix.
Previously, if you opened a new line after an underlined heading (what
the CommonMark spec calls a "Setext heading") or inserted a newline into
a line that started with `**strong emphasis**` the Markdown autoindent
hook would assume the leading symbols were list bullets and paste them
at the beginning of the new line.

However, the CommonMark specification says that list bullets must be
followed by at least one horizontal whitespace character, so Setext
heading underlines and strong emphasis are not valid list bullets and
should not be matched by the autoindent pattern.

This commit changes the regex that selects the pastable prefix of the
previous line so that it must match either:

  - One or more `>` characters with optional whitespace between them
    (a blockquote prefix), optionally followed by a list bullet; or
  - An optional blockquote prefix and a list bullet

Since we don't strictly need either the blockquote prefix nor the list
bullet, we could concievably just make both optional... but for lines
without either, the regex would find a zero-length match, and for the
purposes of copy/paste Kakoune treats that as a one-character match.
Therefore, the regex is written to fail if neither pattern is found.
2017-08-01 20:36:40 +10:00
Dan Rosén
80570a0dc7 Fix reference to kakrc highlighter for markdown 2017-05-15 21:58:57 +02:00
Maxime Coste
5ad4499503 Fix naming conventions in bundled scripts
Do not use _ prefix for hidden commands, use - as a word separator
in command names.
2017-01-13 01:00:43 +00:00
Maxime Coste
91a56c11fe Various auto indent fixes regarding wrong use of x instead of <a-x> 2017-01-13 00:50:03 +00:00
Maxime Coste
5989903e7c Copy comments *before* copying indentation
Fixes #1118
2017-01-11 13:56:48 +00:00
Alex Leferry 2
671b50bb52 update command names 2017-01-04 13:04:27 +01:00
Dan Rosén
5ddc28eaad Fix comment-leader auto-insertion
Fixes #1074
2016-12-29 01:39:02 +01:00
Alex Leferry 2
d80ebbc245 support ```[<space>…]<language> code block 2016-12-27 14:09:20 +01:00
Kylie McClain
516c9591b9 base/markdown: Correct italic/bold detection regex
As specified at https://daringfireball.net/projects/markdown/syntax#em
italics are made with either single asterisks/underscores, and bold is
double asterisks/underscores. Before this, single asterisks were
understood as bold, and only underscores were understood as italics;
both of which behaviors are incorrect.
2016-12-16 00:21:33 -05:00
Martin Chaine
7384288e07 transform mimetype to a fallback option
The option is now used as a fallback when detection by extension fails. Some
scripts like `base/mail.kak` and `base/html.kak` still rely heavily on it.
2016-12-06 17:48:46 +01:00
Martin Chaine
3b6cafd692 Renamed dlang to d 2016-10-09 11:57:55 +02:00
Martin Chaine
e14804fada Renamed golang to go 2016-10-08 21:42:43 +02:00
Maxime Coste
1b9c8b9cf2 Fix hool -> hook in rc files 2016-10-01 14:09:59 +01:00
Maxime Coste
e65aa4a6de Merge remote-tracking branch 'greduan/highlighter-group' 2016-10-01 13:43:21 +01:00
greduan
a68f5f20a1 Add highlight group to highlighters rmhl hooks 2016-09-28 08:45:01 +02:00
greduan
6c6359de93 Add highlight group to highlighters addhl hooks 2016-09-28 08:25:02 +02:00
Frank LENORMAND
9a2f0c350b Add language highlighting to markdown code blocks
Fixes #808
2016-09-24 11:25:58 +03:00
Alex Leferry 2
1b3554c943 support auto-linked email address 2016-02-19 12:31:36 +01:00
Maxime Coste
fef0277998 Reorganise rc/ into subdirectories
* core: set of tools to work on kakoune source code
 * base: very common languages and tools
 * extra: less common languages and tools
2016-01-29 09:03:23 +00:00