With the increasing levels of attention on smart contracts at legal perspective, it has become a hot issue of current research for conversing real-world legal contracts into smart contract programs with the regularization of legal element’s extraction and program conversion. Accordingly, in this paper we propose a contract text markup language (CTML) so as to extract and converse legal elements by annotating the content of syntax, structure and vocabulary in the contract. Firstly, a meta-model of CTML, including three-layer ‘Factor-Property-Component’ semantic structure and metadata markup structure, is established from the perspective of contract templatization and semantic regularization. Based on them, the syntax of CTML is designed, then the legal elements can be extracted and standardized to form an annotated contract using CTML. Secondly, we design specific conversion rules from CTML to SPESC (as a smart legal contract language) through traversing abstract syntax tree (AST) and mapping relationship between two languages. These rules are useful to construct the conversion chain from real-world legal contracts to smart contract program for maintaining the force of law. In addition, taking house sale contract as an example, we illustrate the effectiveness of CTML's semantic extraction and code generation, and therefore the proposed CTML provides an alternative way to build the legalization of smart contracts.