Coder Social home page Coder Social logo

language-gfm's Introduction

Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our official announcement

GitHub flavored Markdown package

OS X Build Status Windows Build Status Dependency Status

Adds syntax highlighting and snippets to GitHub flavored Markdown files in Atom.

Contributions are greatly appreciated. Please fork this repository and open a pull request to add snippets, make grammar tweaks, etc.

language-gfm's People

Contributors

50wliu avatar aerijo avatar alhadis avatar andytlr avatar archaeron avatar asantos3 avatar aureliojargas avatar benogle avatar damieng avatar darangi avatar daviwil avatar emberquill avatar hediyi avatar ionicabizau avatar izuzak avatar jacobbednarz avatar jasonrudolph avatar jcouyang avatar jmgore75 avatar kevinsawicki avatar ldez avatar lee-dohm avatar lkashef avatar maxbrunsfeld avatar mnquintana avatar nickborromeo avatar pimentel avatar probablycorey-and-nathan avatar retrography avatar silvenon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

language-gfm's Issues

Syntax highlighting doesn't work for headers underlined with '=' or '-'

Hopefully the screenshot says it all. For searching purposes if nothing else here's a plain text attempt to explain the problem:

Syntax highlighting in the markdown file itself (in the editor, not the preview) does not seem to work when a header is specified by underlining it with '=' or '-'. It works fine for headers starting with '#' or '##'.

screen shot 2014-12-17 at 16 22 01

Bug with markdown + python

Text below horizontal rule. The issue is that the triple backtick ending the code block
seems to be treated as a docstring. All text after it is green when it should be grey.


Consider this code:

def item_in_list(to_check, the_list):
for item in the_list:
if to_check == item:
return True
return False

So if we call this function like item_in_list(2, [1,2,3]), it should be pretty
quick.

Better Fence Highlighting

Shouldn't fences be able to understand any arbitrary grammar highlighting available to atom? At the bare minimum, they should understand those understood by GFM.

https://github.com/github/linguist/blob/master/lib/linguist/languages.yml

As far as implementation goes, I'm sure there must be some option other than building a ton of regexes for gfm.cson using this YML file. That's probably really inefficient? Is there some way to use a callback with a capture group in the regex?

edit: Solving this issue would solve #33, and any future requests for syntax support. If someone more familiar with atom could describe a better method than parsing that YML, I'd write the PR.

Support 4 space indented code blocks

Given Markdown such as the following:

The following code shows complete example how to use styleguide with gulp-sass and with gulp watch.

    var styleguide = require('sc5-styleguide');
    var sass = require('gulp-sass'),
    var outputPath = 'output';

    gulp.task('styleguide:generate', function() {
      return gulp.src('*.scss')
        .pipe(styleguide.generate({
            title: 'My Styleguide',
            server: true,
            rootPath: outputPath,
            overviewPath: 'README.md',
            styleVariables: 'lib/app/sass/_styleguide_variables.scss'
          }))
        .pipe(gulp.dest(outputPath));
    });

The asterisk in *.scss gets parsed as a Markdown emphasis character, causing the rest of the code block to appear in italics. It looks like the grammar doesn't recognize indented code blocks at all (instead only recognizing fenced code blocks).

This bug isn't visible in the Atom Dark or Atom Light themes, but is visible in the Base 16 Tomorrow themes.

markdown miss-hightlight "bash" when there's the word "until"

From @bric3 on February 21, 2015 14:39

I was writing a simple git documentation for some colleagues, with bash hightlighted snippet, but Atom miss-highlight if there's the until word and only with the bash style.

    ```bash
    git log --since="1 week ago" --until="yesterday"
    ```

Changing the word a little (adding/removing a letter) highlighting is correct.

See :

Incorrect :
screenshot 2015-02-21 at 15 35 06

Correct (but changing one letter of the until letter):
screenshot 2015-02-21 at 15 35 32


OS : OSX 10.10.2 Yosemite
Atom : 0.182.0

Copied from original issue: atom/atom#5664

Folding for markdown headings

It would be nice to have markdown headings fold like the unordered and ordered lists currently do.

For comparison, TextMate folds the area between any heading and the next heading, regardless of level. Instead, I think it would be nicer if headings folded the region from any heading to just above the next heading of equal or higher level. That seems more logical, it follows the logic of dedicated GUI outliners, and it's friendlier to the obsessively organized.

I spent a few minutes looking though the package to see how it's done (in the hope of making a full request), but I never found it. I have basically zero experience with bundles, so that's not surprising, though I did find folding in TextMate's markdown bundle.

Escaped characters not escaped

Backslash does not escape characters.

Atom interprets an with an backslash escaped underline character as start of an italic sequence. The same behaviour is happening with *s.

Like in the Markdown definition is written:

Markdown allows you to use backslash escapes to generate literal
characters which would otherwise have special meaning in Markdown’s
formatting syntax.

Add font selection to specific package

If it's possible, I'd like to be able to specify a different font when working with markdown files (for example a serif font).
Is this in the scope of language-gfm or would that be a more general part of atom (for all packages' settings)?

Trouble With Image Link Markup

I have an image link like this:

[![Aperture Icon](/user/data/images/blog/apps/aperture.png){.image-right .image-25}](http://www.apple.com/aperture/)

Language-GFM chops it into weird pieces:

The first opening [ gets assigned nothing.

![Aperture Icon gets assigned .entity .gfm.

The first closing ] gets assigned nothing.

The final closing ] gets assigned nothing.

I'm not sure if the [] pairs are supposed to get a class, or not. In other situations, they do not, so perhaps that's how it's expected to be.

But in this case, at least the ![ may not be supposed to get a class.

Matching for `, *, _ etc.

For writing Markdown, it would be fairly handy to have characters (like backticks, astrisks and underscores) match.

It seems like the bracket-matcher package pretty much has this covered. With a one line diff I was able to make backticks match:

diff --git a/lib/bracket-matcher.coffee b/lib/bracket-matcher.coffee
index 60245f5..92d9d02 100644
--- a/lib/bracket-matcher.coffee
+++ b/lib/bracket-matcher.coffee
@@ -8,6 +8,7 @@ module.exports =
     '{': '}'
     '"': '"'
     "'": "'"
+    "`": "`"

   activate: ->
     atom.workspaceView.eachEditorView (editorView) =>

But modifying that package doesn't seem like the right thing to do, because:

  1. These characters aren't brackets
  2. Matching these characters makes sense within the confines of Markdown. But probably not for other languages.

I'm happy to explore it but just looking for a bit of guidance:

  • Do you agree that these should be scoped to Markdown, or should I look at extending bracket-matcher?
  • If scoped to Markdown, do you think the best approach would be to work out how to require and extend bracket-matcher within GFM?

YAML Front Matter

Many markdown files have YAML as front matter before the start of the markdown.

Would it be possible for language-gfm to recognize that and style it as does language-yaml?

Single _ Confuses Italics

Text such as _template: page confuses language-gfm into thinking all the rest of the text in the document is italicized.

C++ Syntax highlighting is broken

If an asterisk is used inside of the syntax highlighter for C++ highlighting, it appears it italicizes the rest of the document.

Reduced sample markdown (this appears to work fine on GitHub. It is broken in Atom)
```cpp

struct Italics
{
        Italics *node;
};
```
hello

Support bold italic

GFM, the language, supports _bold italic_ but the syntax highlighting of GFM does not. The following Markdown:

***bold italic***

Is marked up simply as ["source.gfm"] rather than ["source.gfm", "markup.bold.gfm", "markup.italic.gfm"] as I would expect. Another example to try:

*You **can** combine them*

Taken from the Emphasis section of Mastering Markdown.

Automatically insert a new list item

In the most simple form this would insert an empty list item when you hit return.

* List item
* Another item| <--- return

Would insert a new item:

* List item
* Another item
* |

Hitting return again would clear that item.

* List item
* Another item

|

Doing so mid list would also insert a new item, I.e.:

* List item
* |
* Another item

This should work with -, + and - [ ] as well as *. It probably gets more tricky with ordered lists because you'd want to increment the number.

1. List item
2. Another item
3. |

That's probably hard but not as hard as inserting a new list item mid-list and re-numbering all of the items so you don't end up with:

1. First
2. |
2. Second
3. Third

I use a package in Sublime that does something similar, but it isn't great. Byword probably has the best implementation which I've put in gif form:

new list item

I've tried to hack something in with snippets with no success. I thought a solution might be some kind of context aware keymap. But I'm lost as to where to start.

Unrecognized #

language-gfm does not recognize # or ##, etc as headings and applies no classes beyond .source and .gfm.

Scope name should be "text.gfm" instead of "source.gfm"

The line is pretty blurry between text and source, but I feel that since HTML and XML are "text.html" and "text.xml", respectively, that Markdown should also be considered text rather than source.

In the future (hopefully near future) I expect Atom to behave subtly differently depending on whether you're editing text or source ... perhaps like spell-checking text by default or soft wrapping text by default. So I believe this distinction will only become more important to get right over time.

Error with underscores in equations

I am writing a document that contains a lot of TeX in Markdown using Atom. The issue is with underscores that appear in the equations. Here is the problem I am having...

\\[ x_1 = 0.86w^{0.75}_c \\]

I have a few paragraphs here.

\\[ x_2 = 0.92w^{0.79}_b  \\]

The text between the underscore in the first equation (_c) and the second (_b) is being italicized. These underscores are part of a whole word, so they should not be italic markers.

[] and () Pair Classes?

Are the [] and () pairs in entities such as [Aperture] or in links such as (http://www.apple.com/aperture/) expected to get a class? They don't currently.

I would like it if they got .markup .punctuation classes or perhaps the same class as the text inside them.

LaTeX inline highlighting (pandoc flavored)

I know this is supposed to be github flavored markdown. However a number of people are using language-gfm to write their markdown files to be compiled and rendered to pdf via pandoc.

Is it in the scope of this language package to add highlighting of inline LaTeX code in eg. the math-dollars? I am asking because I get the occasional request wether my syntax theme could highlight pandoc features, which I unfortunately have to dismiss because it's not the task of a syntax theme.

If it is not in the scope of this package, I will try to implement some of those features in a separate package if I get the time… Or wait until somebody does so.

thanks for listening! :)

Weird highlighting of ISO date/time string

I noticed this weird highlighting of an ISO date string when writing a Markdown file:

screen shot 2014-03-14 at 19 21 58

(text is
version of 2014-03-14 19:18:38
)

The scopes inside the '18' are:

["source.gfm", "string.emoji.gfm", "string.emoji.end.gfm"] 

Saving Selects All?

Whenever I save a .md file, it saves and then the entire contents of the file is selected. That doesn't happen with other file types.

Do I have something misconfigured, or is this something intended?

Missing support for tables

I'd like to be able to style a few bits of tables independently:

  • Header rows
  • All of the table border punctuation (|, -)
    • The : character should be called out specifically too (as .modifier?)

@mentions do not support semicolons

Fullstop works:

I would like to mention @Bengt.

Colon works:

@Bengt, I would like to mention you.

Semicolon fails:

There is @Bengt; I would like to mention him.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.