So basically this:
Is there a program or something where you can input text and then it automatically adds html tags at the beginning and end of the inputted text, for example:
I type the text: "Life finds a way"
Then the program makes it like this:
<p align="center">"Life finds a way"</p>
Matthew
Have a look at Markdown language.
It's exactly what's used when you post something on StackOverflow. Everything you write is converted to html behind the scenes (that's also why you can't print a tag without using code notation in a post).
So simple text is converted to a <p> tag, unless you break two lines with an empty line.
To create an header, just use :
Header
------
which renders like this:
Header
Or like this :
# Header
## Header
### Header
which renders :
Header
Header
Header
Creating lists is also very handy :
* first item
* second item
which renders :
first item
second item
or if you like numbered lists :
1. first item
2. second item
first item
second item
Bold is as simple as : **Bold**
Italic is : *Italic*
Finally, links are simple:
The wikipedia article is linked like this :
[The wikipedia article](http://en.wikipedia.org/wiki/Markdown)
Related
I am trying to find an easy way to convert my Word documents to HTML without the awful save-as that is built in. These are structured documents (designed for our screen-reader (JAWS) users), and so they use Heading 1, 2, 3, 4 & the Table of Contents.
We plan to convert these to DAISY audiobooks (https://en.wikipedia.org/wiki/DAISY_Digital_Talking_Book ) , so we need pretty clean, but structured, HTML to convert.
I tried the find-replace, using Styles, but it would just replace anything in the text part of the search. I could convert it from any one style to another, but adding text in the box messed it up.
(I think I see that CSS for DAISY means that instead of just <h2> it will have to be <level2 class=='section' <h2> and closing tags), but that's step 2 after I handle this part.)
I just want to be able to find any text using Style 2 and add text to the start of that line saying "yep, here's some style 2" so that I can do the HTML/CSS stuff.
Thanks!
You can do that with a simple Find/Replace. For example, specify the Heading 1 Style for the Find parameter and use:
Replace = <h1>^&</h1>
For a macro you could incorporate that into, see: Convert a Word Range to a String with HTML tags in VBA
I have a simple HTML file only containing a table with no further CSS or any other attributes. The structure of this file never changes, but its content is always different.
I try to match the content of a specific cell (td) which shall give me the name of the first occurence of a contact which has the type 'Misc'.
In my example I try to match the name 'Michael Jackson':
This is what I've got so far:
(<td>\s*Contact:\s*<\/td>((?!<br>).)*<td>\s*Misc\s*<\/td>)
But this only selects the two contact blocks containing the type 'Misc'. I don't know how to go on from this point ...
Here again is my regex and the HTML string I am using:
https://regex101.com/r/xIzr3a/1/
Thanks for any help or advises!
I'm having some difficulty using a RegExp to search for text between HTML tags. This is for a search function to search text on a HTML page without find the characters as a match in the tags or attributes of the HTML. When a match has been found I surround it with a div and assign it a highlight class to highlight the search words in the HTML page. If the RegExp also matches on tags or attributes the HTML code is becoming corrupt.
Here is the HTML code:
<html>
<span>assigned</span>
<span>Assigned > to</span>
<span>assigned > to</span>
<div>ticket assigned to</div>
<div id="assigned" class="assignedClass">Ticket being assigned to</div>
</html>
and the current RegExp I've come up with is:
(?<=(>))assigned(?!\<)(?!>)/gi
which matches if assigned or Assigned is the start of text in a tag, but not on the others. It does a good job of ignoring the attributes and tags but it is not working well if the text does not start with the search string.
Can anyone help me out here? I've been working on this for a an hour now but can' find a solution (RegExp noob here..)
UPDATE 2
https://regex101.com/r/ZwXr4Y/1 show the remaining problem regarding HTML entities and HTML comments.
When searching the problem left is that is not ignored, all text inside HTML entities and comments should be ignored. So when searching for "b" it should not match even if the HTML entity is correctly between HTML tags.
Update #2
Regex:
(<)(script[^>]*>[^<]*(?:<(?!\/script>)[^<]*)*<\/script>|\/?\b[^<>]+>|!(?:--\s*(?:(?:\[if\s*!IE]>\s*-->)?[^-]*(?:-(?!->)-*[^-]*)*)--|\[CDATA[^\]]*(?:](?!]>)[^\]]*)*]])>)|(e)
Usage:
html.replace(/.../g, function(match, p1, p2, p3) {
return p3 ? "<div class=\"highlight\">" + p3 + "</div>" : match;
})
Live demo
Explanation:
As you went through more different situations I had to modify RegEx to cover more possible cases. But now I came with this one that covers almost all cases. How it works:
Captures all <script> tags and their contents
Captures all CDATAblocks
Captures all HTML tags (opening / closing)
Captures all HTML comments (as well as IE if conditional statements)
Captures all targeted strings defined in last group inside remaining text (here it is
(e))
Doing so lets us quickly manipulate our target. E.g. Wrap it in tags as represented in usage section. Talking performance-wise, I tried to write it in a way to perform well.
This RegEx doesn't provide a 100% guarantee to match correct positions (99% does) but it should give expected results most of the time and can get modified later easily.
try this
Live Demo
string.match(/<.{1,15}>(.*?)<\/.{1,15}>/g)
this means <.{1,15}>(.*?)</.{1,15}> that anything that between html tag
<any> Content </any>
will be the target or the result for example
<div> this is the content </content>
"this is the content" this is the result
I have a problem which is probably trivially easy but I can't seem to get it working. Using this post, I do a search using Regex in a text string to convert any links into html markup, but when it comes to display on the page it just displays like this:
this is link
<a href='http://www.google.com'>http://www.google.com</a>
In the view I have:
<p>#news.Body</p>
edit: great my question is now displaying how I want. So now to the actual question, how do I get the page displaying an actual link instead of the code when displayed to the user.
Use `` around your variable (e.g.)
Use "{}" icon in toolbar to insert code
Indent your code by one empty line, 4 spaces and leading empty line
E.g.:
Like this
You can edit this answer to see raw output
(I'm looking for a workaround for Con 3 of Attempt 1 of this question.)
I have a DocBook 5 doc where some glossentry tags contain multiple glossterm tags.
The HTML output for xref tags having a linkend attribute equalling the xml:id of a glossentry looks good (the link text is the first glossterm and the link correctly points to the glossentry) except that its mouseover text (in the title attribute of the HTML) concatenates all of the glossterm texts together.
I would rather it just output the first glossterm (or maybe separate the glossterms with / or a.k.a or something to indicate they're synonyms.)
How would I go about that? I'm new to DocBook and XSLT.