I want to write
http://www.foo.com/
and get a link with the URL as the text (e.g., in HTML output). I do not want to write
[http://www.foo.com/](http://www.foo.com/)
Is it possible?
Yes, here is the relevant section of the documentation:
AUTOMATIC LINKS
Markdown supports a shortcut style for creating “automatic” links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:
<http://example.com/>
Markdown will turn this into:
http://example.com/
I find this works with my IDE nicely, wrapping the link in an <a> tag:
<a>http://example.com/</a>
Related
So I want to be able to add links in the body of a post (and not show it as plaintext). However, I do not want to allow any other HTML tags. Right now I have:
sanitize #post.body, tags: %w(a), attributes: %w(href)
but this does not seem to work.
I've also tried
simple_format(#post.body).gsub(URI.regexp, '\0').html_safe
but that allows other HTML tags, which I do not want.
Any ideas how to fix this? Thanks!
Ruby/Rails will not just identify a link in a string because it has http or www somwhere in it. Assuming you are getting the body of #post via a form, you need to wrap the input in some kind of WYSIWYG editor such as tinymce. Then, if the WYSIWYG editor saves the serialized input:
click to see this link about google.ca
to the database, you can whitelist the <a> tag and href attribute so it actually generates a link
Ended up using the auto_link gem: auto_link(#comment.body)
reStructuredText automatically creates a hyperlink when it sees a URL like https://stackoverflow.com/
Is there a way to prevent this from happening? I just want the link to be in plain-text, no hyperlink.
I know this is easily done in HTML but I am looking for a reST solution.
With a backslash in front of the URL, it is rendered as plain text:
Go to \http://stackoverflow.com
This works with rst2html.py (from Docutils) and with Sphinx.
If I were to put
Replace this
where does this link go to? I am using eldarion-ajax and the examples all use this link location.
Does this link to replace.html?
the div with id #replace
It probably just goes to the url "replace". like if you're at www.website.com/index.html it would go to www.website.com/replace. It's probably just a placeholder indicating you should replace it with another value.
Web URLs do not need to end in .html or such.
I am developing a site in mvc4 where the content of the site includes both latin and cyrillic characters. Both are included in markup and both display correctly on screen.
However, within the markup, I have seen issues with cyrillic where url's for example are like following:
/%d1%81%d0%bf%d0%b8%d1%81%d0%be%d0%ba%20%d0%bf%d0%be%d0%b6%d0%b5%d0%bb%d0%b0%d0%bd%d0%b8%d0%b9
The url navigate correctly when clicked on, but incorrect in html markup. I have the meta charset set to utf-8 in a meta tag.
Any ideas whats causing this?
What you see is correct %-encoded (aka. URL-encoded) form of the URL “/список пожеланий” (as you can see using a decoder). Browser may display a URL in their address bar as %-encoded, or as decoded to characters. HTML authoring software or, in manual editing of HTML code, the author should take care of %-encoding anything that needs to be %-encoded at the HTTP protocol level, such as href attribute values.
In my rails application, people are supposed to submit "posts." However, in the default scaffolding, there are some problems in the text input: not allowed HTML code, changing the line doesn't work, etc. From what I've learned, I need to use a markdown-markup language to solve this issue. Is there a guide for me to follow to apply such language to solve my problem?
UPDATE: Here are my problems.
1) Every sentence is combined into one line even if I put a line space.
first line
second line
becomes
first line second line
2) I can't make text bold, italicized, or hyperlink. Like in stackoverflow, user should easily put <b> and make bold text, ** to make italicized, etc. And URL address should automatically be translated to href link.
To do these, I thought I had to use markdown library. I could be mistaken, so I needed someone to guide me through. Railscasts on Markdown
Well, yes, new lines in HTML have no meaning. You need to replace line breaks with <br> to preserve them in HTML. To automatically highlight links, you need to look for links in the text and wrap them in appropriate <a> tags. Finally, if you're not filtering HTML tags, they should still be in there. It all depends on what you're doing. Markdown is something entirely different, a special markup language that enables you to do the above while being easier to write than HTML. It depends on what you want to use.