GithubHelp home page GithubHelp logo

ldt's People

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

ldt's Issues

.ldt label should clone textarea’s styles

For now style of textarea is unable to be changed, because it will cause bad .ldt label offsets.
I think, it’d be nice for LDT to try to clone generic textarea’s padding, border and other vital styles, in order to behave less rigidly.

Unable to lookahead/lookbehind accross tokens

Say I want to make a parser for a markdown file but it's able to contain tags/annotations like @foo(bar). I want to color the contents of bar but only if there's a @foo before it - so I tried something like this:

        var parser = new Parser({
            whitespace: /\s+/,
            tagKey: /@\w+/,
            tagValue: /(?<=@\w+)\([^\)]+\)/,
            other: /\S/
        });

But this did not work. When I read the api for a parser, I realized that it's probably first breaking them into separate tokens and then applying the regexes to recognize the type of each token.

Is there a way to achieve what I want or does the api not support this? Maybe you could have support for parsers that can do both .tokenize() and .identify() in one go which would allow this?

Github Pages not found

Issue

The page linked is: https://kueblc.github.com/LDT/. But it gives 404 - There isn't a GitHub Pages site here.

Thoughts

Github Pages isn't listed as an active environment in the lower left, so maybe it got disabled via settings?

Or maybe it's just not working because there isn't an index.html in root?

Tabs don't work in IE

In Internet Explorer 8, the tab character has a non-standard width of 6.5 in the input layer, and a width of 1 in the output layer, causing misalignment.

Would you be interested in a version that works with line wraps

I use a modified version of LDT in one of my personal projects. I changed it so that it allows line wraping, and also refactored some of it to follow the standard convention of storing methods in a prototype.

If I repackage my changes to make them optional, would you be interested in pulling from me?

Getting a tighter fit around the text

Adding

    if (input.charAt(input.length - 1) === '\n') input += "\n"

at the start of color() and

.ldt pre:empty::after {
  display:block;
  content: " "
}

in the CSS file lets one set the rows to the exact number of lines at the end of update().

This results in a better behavior IMO (no container overflow).

Live example with a "gutter" plugin adapted to the new number of rows.

Edit: :empty is IE9+. I don't know how important IE7 compat is to you and the LDT user base at this point... I'd expect it to be low... I can send a PR if you're interested.

I'd just like to say that I love this library.

@kueblc this thing kicks some serious booty.

I'm using LDT to syntax-highlight TailwindCSS classes in an HTML editing layer for a WordPress page-building tool.

Lightweight syntax highlighting opens up so many doors if you offer textareas as 'faux code editors' to help less experienced designers know 'what's safe to edit,' etc.

Great work. Happy to use this and very much on board with supporting it, if it's still being worked on.

Dave Bloom

How can I change the highlighting core?

Very nice and brilliant project. We want to have it for our language Arendelle and for Arendelle we have a library that generates span based HTML for highlighting on the web pages.

marker.js project we have has this function markerHighlight that takes string Arendelle and generates HTML for highlighting and we want to replace it with your backend for the highlighting.

The question is which parts of the code much be changed for proper implementation of this idea?

Keybinder: Grab input text

I would like to be able to react on the entering of special characters. For instance, when the user types in {, I would like to automatically add a closing }.

Previously I had tried using LDT in tandem with BehaveJS...but that did not go well, because Behave.JS "ate" the backspace key; which would prevent api.update() to be called.

iOS text shadow

I know it's not one of the officially supported browsers, but I tried it in iOS (UIWebView). There is a shadow of the text. It looks like maybe the underlying textarea is being render in light gray and is slightly offset a couple pixels. Also it is murderously slow, even for a small bit of text. On the plus side, it reacts to touch events properly (no 300ms delay, drag selection ok, etc.). These are issues that make other similar solutions like codeMirror unusable on iOS.

Publish to npm

If you'd like to publish the package to npm, I've added you to npm.com/ldt as an owner, please feel free to publish any version.

How do I use a nicer font?

Monospace is nice for coding, but for my usage of LDT, I want to use a pretty text. So I'd like to use something like Arial or Verdana instead of a monospace font, simply because monospace does not look all too nice.

But using any other font than a monospaced one will cause the letters to be shifted. The letters in the textarea have a wider spacing than in the pre.

Why is that?

Horizontal scrollbar

Is there any way to remove horizontal scrollbar for it without losing correct rendering?

Match exactly the beginning of a line (Writing a Markdown highlighter)

As indicated in the title, I am trying to create a Parser ruleset to highlight Markdown.

So far, I can perfectly match the inline stuff for bold and italic text as well as other stuff. However, I am unable to match headers, lists and proper code fences.

It would be nice if you could help me out there! This is my Parser so far:

        var rules = {
            list: /[-\*]\s[^\n\r]*\n?/,
            header: /#\s[^\n\r]*\n?/,
            "bold fix": /[\*\_]{2}[^\_\*\r\n]*[\*\_]{2}?/,
            "italic fix": /[\_\*][^\_\*\r\n]*[\_\*]?/,
            strike: /-[^-]*-?/,
            code: /```[\r\n].*[\r\n]```/,
            quote: />[^\r\n]*\n?/,
            mention: /@[^@\r\n]([a-z0-9\-\._]*)?/,
            url: require("url-regex")(), // Dink! :)
            ip: require("ip-regex")(),
            email: require("email-regex")(),
            hashtag: /(#[a-z0-9][a-z0-9\-_]*)/,
            whitespace: /\s+/,
            other: /\S+/
        };

Kind regards, Ingwie.

Setting bold/italic will cause misalignment on Windows

In Firefox 3.6 and IE8 on Windows, non-regular font styles may overflow causing misalignment. This can be avoided for single line tokens by setting display to inline-block and decreasing the bottom margin, (ex, margin-bottom: -1px;).

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.