Web Author - codeblock line numbers
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 14
- Joined: Fri Jan 22, 2021 5:01 pm
Web Author - codeblock line numbers
Post by Johannab_31 »
Hello,
I'm looking to add line numbers for the codeblock element in the Web Author editor.
I tried using CSS, but I couldn't achieve it as a new line is not available as a CSS Selector.
Just wondering if you know if it's possible or maybe have an example?
Many Thanks,
Johanna Bolton
I'm looking to add line numbers for the codeblock element in the Web Author editor.
I tried using CSS, but I couldn't achieve it as a new line is not available as a CSS Selector.
Just wondering if you know if it's possible or maybe have an example?
Many Thanks,
Johanna Bolton
-
- Site Admin
- Posts: 163
- Joined: Tue Mar 20, 2018 5:28 pm
Re: Web Author - codeblock line numbers
Post by Bogdan Dumitru »
Hello Johanna,
The best way to implement line-numbers for a codeblock is to define a FormControl that allows you to change the HTML of the document. See this tutorial [1].
With CSS you definitely won't be able to achieve line numbers from a framework CSS but you might be able to render something with a application CSS like this:
Please note that the above snippet has many flows, it's just an idea and we recommend implementing a Form Control. To apply the application CSS see this [2] sample plugin.
[1] https://www.oxygenxml.com/maven/com/oxy ... ntrol.html
[2] https://github.com/oxygenxml/web-author ... i-with-css
The best way to implement line-numbers for a codeblock is to define a FormControl that allows you to change the HTML of the document. See this tutorial [1].
With CSS you definitely won't be able to achieve line numbers from a framework CSS but you might be able to render something with a application CSS like this:
Code: Select all
div[data-name="codeblock!"] {
text-wrap: nowrap;
white-space: pre;
display: flex !important;
}
div[data-name="codeblock!"]:before {
content: "1\a 2\a 3\a 4\a 5\a 6";
text-wrap: wrap;
height: calc(100% - 15px);
position: absolute;
overflow: hidden;
color: #adadad;
border-right: 1px solid gray;
padding-right: 4px;
}
div[data-name="codeblock!"] > span[data-role="text"] {
white-space: pre !important;
width: 100%;
display: block;
overflow: auto;
}
[1] https://www.oxygenxml.com/maven/com/oxy ... ntrol.html
[2] https://github.com/oxygenxml/web-author ... i-with-css
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
-
- Site Admin
- Posts: 163
- Joined: Tue Mar 20, 2018 5:28 pm
Re: Web Author - codeblock line numbers
Post by Bogdan Dumitru »
Hello Johanna,
The best way to implement line-numbers for a codeblock is to define a FormControl that allows you to change the HTML of the document. See this tutorial [1].
With CSS you definitely won't be able to achieve line numbers from a framework CSS but you might be able to render something with a application CSS like this:
Please note that the above snippet has many flows, it's just an idea and we recommend implementing a Form Control. To apply the application CSS see this [2] sample plugin.
[1] https://www.oxygenxml.com/maven/com/oxy ... ntrol.html
[2] https://github.com/oxygenxml/web-author ... i-with-css
The best way to implement line-numbers for a codeblock is to define a FormControl that allows you to change the HTML of the document. See this tutorial [1].
With CSS you definitely won't be able to achieve line numbers from a framework CSS but you might be able to render something with a application CSS like this:
Code: Select all
div[data-name="codeblock!"] {
text-wrap: nowrap;
white-space: pre;
display: flex !important;
}
div[data-name="codeblock!"]:before {
content: "1\a 2\a 3\a 4\a 5\a 6";
text-wrap: wrap;
height: calc(100% - 15px);
position: absolute;
overflow: hidden;
color: #adadad;
border-right: 1px solid gray;
padding-right: 4px;
}
div[data-name="codeblock!"] > span[data-role="text"] {
white-space: pre !important;
width: 100%;
display: block;
overflow: auto;
}
[1] https://www.oxygenxml.com/maven/com/oxy ... ntrol.html
[2] https://github.com/oxygenxml/web-author ... i-with-css
Bogdan Dumitru
http://www.oxygenxml.com
http://www.oxygenxml.com
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service